>
> Looking up data is not a responsibility of the EntityManager: it's a 
> repository concern.


In the example bug tracker demo from the docs, the Entity Manager is used 
for finding and displaying the list of bugs :

$dql = "SELECT b, e, r FROM Bug b JOIN b.engineer e JOIN b.reporter r ORDER BY 
b.created DESC";
$query = $entityManager->createQuery($dql);$query->setMaxResults(30);$bugs = 
$query->getResult();


Is createQuery a shortcut too? As you should normally use a repository to 
look up for data as you said.




On Sunday, 19 October 2014 16:39:07 UTC+2, Marco Pivetta wrote:
>
> On 19 October 2014 16:36, Mathieu Decaffmeyer <[email protected] 
> <javascript:>> wrote:
>
>>
>> Hi, the EntityManager provides a method to find an entity:
>> find( string $entityName, mixed $identifier, integer $lockMode = 
>> Doctrine\ORM\LockMode::NONE, integer $lockVersion = null )
>> the EntityRepository also provides a find method:
>> find( mixed $id, integer $lockMode = Doctrine\ORM\LockMode::NONE, integer 
>> $lockVersion = null )
>>
>> But why is there findAll method in the EntityRepository and not in the 
>> EntityManager (just like the find() method) ?
>> e.g. $entityManager->findAll('Product');
>>
>
> Looking up data is not a responsibility of the EntityManager: it's a 
> repository concern.
> The `find` method on the EntityManager was just introduced as utility 
> method.
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>   
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to