irtgca
Last Updated: February 25, 2016
·
3.268K
· andreia
Mesr

Symfony2 and Doctrine2: INDEX BY in QueryBuilder

E.g.: INDEX BY id of the User entity:

$qb = $em->createQueryBuilder();

$qb->select('u')
   ->from('SomeUserBundle:User', 'u', 'u.id')
   ->add('where', $qb->expr()->like('u.roles', ':role'))
   ->setParameter('role', $role);

Reference:
http://www.doctrine-project.org/jira/browse/DDC-2322

Say Thanks
Respond