-
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
[DDC-1663]Native SQL Query Result Set Mappings #293
Conversation
* @param array $queryMapping | ||
* @return ResultSetMappingBuilder | ||
*/ | ||
public function addNamedNativeQueryMapping(ClassMetadataInfo $class, array $queryMapping) |
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.
can you refactor this into smaller submethods? its much to large imho.
Hi. Is done for me. Please take a look and tell me if can I make something better or add another test case. //cc @guilhermeblanco , @beberlei , @Ocramius , @asm89 . |
} | ||
|
||
if (isset($this->namedNativeQueries[$queryMapping['name']])) { | ||
throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']); |
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.
This can actually bring to problems when Bundles/Modules define same native queries (like allUsers
). I guess there's no solution for that...
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.
Hi @Ocramius
Sorry I don't get this ...
The named native queries follows the same behavior of name queries.
A query name should be unique in a entity and could be override in a sub class..
please, could you explain ?
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 maybe it's too much of an edge case :) No worries, just ignore it... Bundles extending other entities should be aware of what problems they're running in :)
As @beberlei already pointed out, this uses advanced features, and it is not really intuitive... But it is an useful addition. If I get it correctly, the suggested usage is to recycle named queries defined in the Also, I'm a bit scared about how much the metadata drivers are growing in code size... Hopefully such additions won't appear too often :P (also remembers me that I have a WIP...) |
Also noting: feature is clear after some chatting on IRC. Not that clear from the code. Yeah, it's all internal stuff, but still a bit complex to grasp... |
testing github 2 jira updates. |
another test |
[DDC-1663]Native SQL Query Result Set Mappings
Hello
http://www.doctrine-project.org/jira/browse/DDC-1663
This patch adds support for native query mapping
This is not complete yet but a would like to get your sugestions about this.
The following annotations have been added :
@NamedNativeQuery
: Is used to specify a native SQL named query.@SqlResultSetMapping
: Is used to specify the mapping of the result of a native SQL query.@EntityResult
: References an entity in the SELECT clause of a SQL query.@FieldResult
: Is used to map the columns specified in the SELECT list of the query to the properties or fields of the entity class.@ColumnResult
: References name of a column in the SELECT clause of a SQL query. (scalar values)It is a very big feature so any suggestion are welcome. :)
Thanks