GithubHelp home page GithubHelp logo

Query results about mongodb-odm HOT 8 CLOSED

arnobeck avatar arnobeck commented on June 19, 2024
Query results

from mongodb-odm.

Comments (8)

jwage avatar jwage commented on June 19, 2024

This needs to be fixed. Use the foreach and it will work.

Sent from my iPhone

On May 17, 2011, at 9:16 AM, [email protected] wrote:

Hello,

I make a query :
$users = $dm->getRepository('Documents\User')->findBy(array('username' => 'toto'));

if I make that :
while($users->hasNext())
{
$user = $users->getNext();
print_r($user);
}

The print_r shows me an array and not a User Document. Where is the problem ?
Please, help me.

Reply to this email directly or view it on GitHub:
#95

from mongodb-odm.

arnobeck avatar arnobeck commented on June 19, 2024

Thanks, it works.

Now a last question :
I've generated a Repository for my User Document. And I have set that in the document with : repositoryClass="Repositories\UserRepository"
In this repository, I have defined a findByToto function.
But when I want to execute my function, I get this error :
Fatal error: Class 'Repositories\UserRepository' not found in .../mongodb_odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php

from mongodb-odm.

jwage avatar jwage commented on June 19, 2024

Hi,

Make sure you specify the right path to the class.

That class cannot be found hence the error.

  • Jon

On Tue, May 17, 2011 at 9:47 AM, arnobeck <
[email protected]>wrote:

Thanks, it works.

Now a last question :
I've generated a Repository for my User Document. And I have set that in
the document with : repositoryClass="Repositories\UserRepository"
In this repository, I have defined a findByToto function.
But when I want to execute my function, I get this error :
Fatal error: Class 'Repositories\UserRepository' not found in
.../mongodb_odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php

Reply to this email directly or view it on GitHub:
#95 (comment)

Connect with me on http://twitter.com/jwage http://twitter.com/jwage
and http://about.me/jwage to keep in touch.

from mongodb-odm.

arnobeck avatar arnobeck commented on June 19, 2024

It doesn't work.

I'm using the sandbox. I've just done :
./mongodb odm:generate:repositories

And in the user document, I've put :
/** @document(collection="users", repositoryClass="Repositories\UserRepository") */
class User

from mongodb-odm.

jwage avatar jwage commented on June 19, 2024

Hi,

Where does Repositories\UserRepository exist?

  • Jon

On Tue, May 17, 2011 at 10:33 AM, arnobeck <
[email protected]>wrote:

It doesn't work.

I'm using the sandbox. I've just done :
./mongodb odm:generate:repositories

And in the user document, I've put :
/** @document(collection="users",
repositoryClass="Repositories\UserRepository") */
class User

Reply to this email directly or view it on GitHub:
#95 (comment)

Connect with me on http://twitter.com/jwage http://twitter.com/jwage
and http://about.me/jwage to keep in touch.

from mongodb-odm.

arnobeck avatar arnobeck commented on June 19, 2024

$ ls Repositories/*
Repositories/UserRepository.php

from mongodb-odm.

jwage avatar jwage commented on June 19, 2024

Do you have an autoloader setup to load those classes in that namespace?

  • Jon

On Tue, May 17, 2011 at 10:43 AM, arnobeck <
[email protected]>wrote:

$ ls Repositories/*
Repositories/UserRepository.php

Reply to this email directly or view it on GitHub:
#95 (comment)

Connect with me on http://twitter.com/jwage http://twitter.com/jwage
and http://about.me/jwage to keep in touch.

from mongodb-odm.

arnobeck avatar arnobeck commented on June 19, 2024

It was that, thanks

from mongodb-odm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.