Skip to content
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] Fix type conversion during hydration of pagination limit subquery #7905

Merged
merged 2 commits into from
Nov 18, 2019

Conversation

lcobucci
Copy link
Member

Continuation of #7890 and #7903, however, using an implementation that keeps DB->PHP conversion contained in the hydrator.

Copy link
Member

@ostrolucky ostrolucky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously much better solution. Got some comments before approving.

lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php Outdated Show resolved Hide resolved
lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php Outdated Show resolved Hide resolved
ostrolucky and others added 2 commits November 18, 2019 10:27
We're keeping a BC layer in the hydrator, which prevents type conversion
in scalar results.

This makes bypasses such layer in order to always convert the identifier
types when limiting the result set during a pagination.

The main goal here is to keep the conversion DB->PHP inside of the
hydrator components.
@lcobucci lcobucci merged commit 686f508 into doctrine:2.6 Nov 18, 2019
@lcobucci lcobucci deleted the 7890-paginator-objecti branch November 18, 2019 09:56
@lcobucci
Copy link
Member Author

@akorz can you please confirm that this solves the issue you mentioned? We'd like to release 2.6.5 today but only after your ok.

@lcobucci lcobucci added this to the 2.6.5 milestone Nov 18, 2019
@akorz
Copy link
Contributor

akorz commented Nov 18, 2019

@lcobucci i'll check it right now

@akorz
Copy link
Contributor

akorz commented Nov 18, 2019

Well, bad news...

I have a project with a lot of tests. Before that fix I had 101 failures in my tests. Using that fix I got 25 failures. Once I deleted this line of code https://github.com/doctrine/orm/pull/7821/files#diff-1a0c7b79092b175a78f64ed6c44c8c8cR113 my tests had passed.

My previous huge diff also had the same behavior. The reason is https://github.com/doctrine/orm/pull/7821/files#diff-1a0c7b79092b175a78f64ed6c44c8c8cR113

@ostrolucky
Copy link
Member

I think you checked out wrong branch. Can you check out 2.6, not the one in referenced PR? That one was never merged.

@akorz
Copy link
Contributor

akorz commented Nov 18, 2019

@ostrolucky it's a part my composer.lock

            "name": "doctrine/orm",
            "version": "v2.6.4",

I just took changed files from that pull requests I replaced them in my vendor folder by hands. Is it wrong way?

@ostrolucky
Copy link
Member

It's wrong pull request where you took the changes from. Just do composer require doctrine/orm:2.6.x-dev

@akorz
Copy link
Contributor

akorz commented Nov 18, 2019

Tests are passed. Thank you guys for your great work! :)

@lcobucci
Copy link
Member Author

@akorz awesome! Releasing 🚀

lcobucci added a commit to lcobucci/doctrine2 that referenced this pull request Feb 15, 2022
Since v2.7.0 the ORM avoids using extra queries via the paginator
component when maximum results isn't set on the original query. With
that change, this test was not executing the code path that it was
expected to run.

This makes sure we trigger the forcing of custom DBAL types when
hydrating the identifiers, making sure we don't introduce bugs.

More info:
- Forcing DBAL type conversion: doctrine#7905
- Issue on optimisation: doctrine#7829
- PR on optimisation: doctrine#7863
- Minor BC-break docs: https://github.com/doctrine/orm/blob/2.11.x/UPGRADE.md#minor-bc-break-paginator-output-walkers-arent-be-called-anymore-on-sub-queries-for-queries-without-max-results
lcobucci added a commit to lcobucci/doctrine2 that referenced this pull request Feb 15, 2022
Since v2.7.0 the ORM avoids using extra queries via the paginator
component when maximum results isn't set on the original query. With
that change, this test was not executing the code path that it was
expected to run.

This makes sure we trigger the forcing of custom DBAL types when
hydrating the identifiers, making sure we don't introduce bugs.

More info:
- Forcing DBAL type conversion: doctrine#7905
- Issue on optimisation: doctrine#7829
- PR on optimisation: doctrine#7863
- Minor BC-break docs: https://github.com/doctrine/orm/blob/2.11.x/UPGRADE.md#minor-bc-break-paginator-output-walkers-arent-be-called-anymore-on-sub-queries-for-queries-without-max-results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants