-
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-2794] Arbitrary Join count walkers solution #1092
Conversation
Possible solution for Arbitrary Join problem in pagination count walkers: https://groups.google.com/forum/#!topic/doctrine-user/rpPYCDNKOU8 Added a condition to test query component against SelectStatement from clause
@birko an sql generation test is highly required here... |
@Ocramius Indeed, Will be working on it |
changed root selection in Walkers from looping queryComponents to using $AST->fromClause as other walkers have
Missing braces and selected fields
Hope this test are sufficient in this PR |
@guilhermeblanco could you review this? Looks sane to me, and it would allow using the paginator with arbitrary joins :-) |
$queryComponents = $this->_getQueryComponents(); | ||
// Get the root entity and alias from the AST fromClause | ||
$from = $AST->fromClause->identificationVariableDeclarations; | ||
if (count($from) > 1) { |
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.
empty newline before this line
Looks good, and the code is even simpler! There is a minor code duplication (when fetching the root component), but fixing it would require too much over-engineering here. 👍 |
👍 |
note that the related issue is http://www.doctrine-project.org/jira/browse/DDC-2794 |
@Ocramius I will update the code according your comments. I was on vacation this week |
$queryComponents = $this->_getQueryComponents(); | ||
// Get the root entity and alias from the AST fromClause | ||
$from = $AST->fromClause->identificationVariableDeclarations; | ||
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable; |
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.
The AST doesn't ensure that the array is indexed starting from 0
, so this should probably be reset($from)
This seems mergeable to me, except for my nitpicking. @birko can you just verify if any docs requires updating? |
@Ocramius will check |
changed usage $from[0] according suggestion from @Ocramius to use array reset function
I looked slightly into the docs but did not find any reference that pagination is not working with Arbitrary joins. so I think the docs are ok |
Hmm any progress what should I fix to get this merged? |
[DDC-2794] Arbitrary Join count walkers solution
@birko thanks for the reminder, merged! Thanks for the clean code as well :-) |
@Ocramius No problem. Thanks for your hints as well :) |
@birko Thanks |
Possible solution for Arbitrary Join problem in pagination count
walkers:
https://groups.google.com/forum/#!topic/doctrine-user/rpPYCDNKOU8
Added a condition to test query component against SelectStatement from
clause