Improved DQL's "new" operator documentation
I had to dig through the pull requests and issues to figure that out, so I believe it's best documented explicitly.
This commit is contained in:
parent
bba5ec27fb
commit
330c66559c
@ -509,6 +509,8 @@ And then use the ``NEW`` DQL keyword :
|
|||||||
$query = $em->createQuery('SELECT NEW CustomerDTO(c.name, e.email, a.city, SUM(o.value)) FROM Customer c JOIN c.email e JOIN c.address a JOIN c.orders o GROUP BY c');
|
$query = $em->createQuery('SELECT NEW CustomerDTO(c.name, e.email, a.city, SUM(o.value)) FROM Customer c JOIN c.email e JOIN c.address a JOIN c.orders o GROUP BY c');
|
||||||
$users = $query->getResult(); // array of CustomerDTO
|
$users = $query->getResult(); // array of CustomerDTO
|
||||||
|
|
||||||
|
Note that you cannot pass entities as constructor parameters for now.
|
||||||
|
|
||||||
Using INDEX BY
|
Using INDEX BY
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user