-
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
QueryBuilder::addCriteria improvements #584
QueryBuilder::addCriteria improvements #584
Conversation
…essionVisitor. Add criteria field aliasing.
Hello, thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link: |
I don't like that the visitor gets all the additional code, this is not really his responsibility. |
I don't see a good way to implement this features outside. Parameter and alias handling require visit all expressions. |
The visitor seems to be at least partially responsible here. All of the expressions need to be visited to add the alias in the WHERE expression. The visitor was already doing this. However, with this implementation, the visitor gains the now:
Those three things can be can be corrected. What would be the acceptable solution here?
|
This PR can be splitted into 2 parts like described in annotation:
The only way to break the logic i see is to create independent FieldAliasVisitor for Criteria -> Criteria converting @beberlei What do you think? |
@beberlei Any news? I can remove field alias from this PR and just save the parameter bugfix, which can be applied for 2.4 |
ping @beberlei it would be great to either merge this, or find an alternative Criteria still can't be used on the QueryBuilder in 2.4. We use it to implement Domain Driven Design, in which a Repository behaves like an in-memory collection. Criterias are supposed to be an abstraction for filtering collections, but right now it's only usable with ArrayCollections, so it kind of defeat the purpose of the abstraction. |
I merged a fix for this by into master. |
See 35a62e9 |
First level fields are added with alias, second+ level fields (object.field, parent.object.field) are truncated to the second level (object.field) without alias. Alias map can be implemented in future.