-
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
Paginator fixes take3 #1353
Paginator fixes take3 #1353
Conversation
…association. Manual merge testcase from doctrine#1351
Conflicts: tests/Doctrine/Tests/OrmFunctionalTestCase.php
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3645 We use Jira to track the state of pull requests and the versions they got |
@vaheshadunts @alexander-orabey I believe this fixes both of your issues... Please test. |
@mrkrstphr Does this fix your issue? |
@zeroedin-bill no, it does not. I will try to write a failing test tomorrow. |
@mrkrstphr Ok, thanks - the functional testsuite is taking shape, and that should help prevent regressions like this in the future. What platform are you running on? |
Test suite runs in sqlite.
|
@zeroedin-bill as I see its ok in travis, I'll merge and test it later, thanks. |
Hi, I don't know is it related but now this query is throwing exception
Exception:
If I remove Now its impossible to use Paginator when where is ordering and subquery with count()
|
@zeroedin-bill it looks like our issue is cases that use table inheritance with an inheritance type of For a test case, should I put that in |
Since most of PaginationTest is new, and it hasn't been merged, please put Thanks!
|
Conflicts: tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php
@antanas-arvasevicius - fixed and added a testcase, thanks |
@zeroedin-bill here is a failing test case: https://github.com/doctrine/doctrine2/compare/master...mrkrstphr:paginator-test-for-joined-inheritance?expand=1 |
Great, thanks :) Bill Schaller On Mon, Mar 30, 2015 at 11:19 AM, Kristopher Wilson <
|
…eritance' into paginator-fixes-take3 Conflicts: tests/Doctrine/Tests/ORM/Functional/PaginationTest.php
…table inheritance
@mrkrstphr - merged and fixed. |
@@ -39,17 +49,17 @@ class LimitSubqueryOutputWalker extends SqlWalker | |||
/** | |||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform | |||
*/ | |||
private $platform; | |||
private $_platform; |
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.
please don't add the underscore prefix. We are getting rid of it, not adding new ones
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.
@stof - I actually ran into some really strange behavior with this. These properties were hiding the private ones from the parent class, but when I overrode walkSelectStatement, I was getting a notice saying that these private variables were undefined. It was really odd. I'll try backing the underscores out and see if I can reproduce.
Ideally these variables should just be protected on SqlWalker, but I didn't want to push changes too far out from LimitSubqueryOutputWalker.
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.
Of course, when I try to reproduce, the error is gone...
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.
@stof Please see http://www.doctrine-project.org/jira/browse/DDC-3688 - this is the issue I was talking about... Any ideas? Reference: #1220. This user is trying to use FOSUserBundle with the new code and is seeing this issue and others.
* @param $AST | ||
* @return array | ||
*/ | ||
private function getSQLIdentifier($AST) |
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.
should be typehinted
@stof resolved comments, thanks |
@zeroedin-bill thank you very much! |
… handled by LimitSubqueryOutputWalker
The failure comes into play when an entity has an attribute named differently from its corresponding column name.
@zeroedin-bill found another issue: billschaller#1 |
@zeroedin-bill commenting out this function call (https://github.com/zeroedin-bill/doctrine2/blob/paginator-fixes-take3/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php#L424) seems to fix it, and doesn't cause any other errors. Is this call necessary? |
…es different from column names
@mrkrstphr fixed, thanks :) |
Our test suite now passes with this branch. Thanks! |
@mrkrstphr Thanks for your help and testing 👍 |
Merged into |
This PR fixes issues reported in #1347 and #1351.
This patch converts LimitSubqueryOutputWalker to use the ROW_NUMBER window function for queries on platforms that support it. Other platforms use a modified version of the previous method. The modification is to not select the ORDER BY columns in the wrapping query. The reason those columns were selected like that in the first place is that ORDER BY on columns not in the select list is unsupported on many platforms. MySQL and SQLite are fine with it, and don't support ROW_NUMBER.
The ROW_NUMBER solution is actually much simpler.
LimitSubqueryOutputWalker SQL generation tests for PG and Oracle have been changed.
There are 2 failing expectedException tests right now. The LimitSubqueryWalker needs to be modified to throw an exception when it detects a query that does the following things together:
As with the previous patch, this depends on changes to SQLServerPlatform2008 that have not yet been merged. SQLServerPlatform2008 in DBAL/master currently mangles the generated queries when trying to apply LIMIT/OFFSET.