Merge pull request #915 from mnapoli/patch-1
Improved DQL's "new" operator documentation
This commit is contained in:
commit
9b7e949025
1 changed files with 2 additions and 0 deletions
|
@ -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 can only pass scalar expressions to the constructor.
|
||||||
|
|
||||||
Using INDEX BY
|
Using INDEX BY
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue