Skip to content

Commit

Permalink
Update repositoryMethod documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed Mar 24, 2015
1 parent a95e871 commit eabd92a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/en/reference/complex-references.rst
Expand Up @@ -127,8 +127,10 @@ The ``Comment`` class will need to have a custom repository class configured:
}
Lastly, the ``CommentRepository`` class will need a ``findSomeComments()``
method. When this method is called to populate the reference, Doctrine will
provide the Blogpost instance (i.e. owning document) as the first argument:
method which shall return either ``Doctrine\ODM\MongoDB\Cursor`` or
``Doctrine\ODM\MongoDB\EagerCursor``. When this method is called to populate
the reference, Doctrine will provide the Blogpost instance (i.e. owning
document) as the first argument:

.. code-block:: php
Expand All @@ -141,7 +143,9 @@ provide the Blogpost instance (i.e. owning document) as the first argument:
*/
public function findSomeComments(BlogPost $blogPost)
{
return $this->findBy(array(/* ... */));
return $this->createQueryBuilder()

This comment has been minimized.

Copy link
@acrozes

acrozes Mar 30, 2015

Maybe add

->field('post')->references($blogPost); 

for a beginer like me ;)

This comment has been minimized.

Copy link
@jmikola

jmikola Jun 13, 2015

@acrozes: Done in doctrine@7049f40. Thanks for the suggestion.

// ...
->getQuery()->execute();
}
}
Expand Down

0 comments on commit eabd92a

Please sign in to comment.