-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved DQL's "new" operator documentation #915
Conversation
I had to dig through the pull requests and issues to figure that out, so I believe it's best documented explicitly.
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-2928 We use Jira to track the state of pull requests and the versions they got |
@@ -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'); | |||
$users = $query->getResult(); // array of CustomerDTO | |||
|
|||
Note that you cannot pass entities as constructor parameters for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be passed if I replace e.email
with e
? PK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC there was an error because an int
was given, and I type-hinted the constructor with the object. Maybe the int
is the entity id? I have no idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only scalar expressions are supported..
Everything else causes a syntaxError/QueryException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabioBatSilva OK, I improved the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabioBatSilva I've tryed fill entity alias - got PK.
ping to anyone who can merge this is very trivial :) |
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.