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

Verify UnitOfWork::HINT_DEFEREAGERLOAD exists and is true #10808

Merged

Conversation

oscmarb
Copy link

@oscmarb oscmarb commented Jun 28, 2023

In some EAGER relationships a proxy instance is always retrieved instead of an instance of the class. This is because there is the UnitOfWork::HINT_DEFEREAGERLOAD hint, which cannot be deactivated even when the DQL indicates that the load should be EAGER or when we execute:

$query->setHint(UnitOfWork::HINT_DEFEREAGERLOAD, false);

With the change introduced by executing the line above, the value of HINT_DEFEREAGERLOAD will be taken into account, and lazy loading will only occur when HINT_DEFEREAGERLOAD is true.

Copy link

@dvil88 dvil88 left a comment

Choose a reason for hiding this comment

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

I'm having the same problem and this definitely solved it.

@greg0ire
Copy link
Member

Can you please add tests?

@greg0ire
Copy link
Member

Please read the contribution guide, it shows how to deal with failing checks locally.

@oscmarb
Copy link
Author

oscmarb commented Aug 24, 2023

Yep, sorry, I forgot to run cs. It is fixed.

@greg0ire
Copy link
Member

Please kindly squash your commits together. If you don't, we'll try to remember to do it for you but it's best if you save us this trouble.

How to do that?

  1. git rebase -i origin/2.15.x, assuming origin is a git remote that points to this repository, and not your fork. If you're not sure what your remotes are, run git remote -vvv, there should be your fork and the holy/reference/base/origin/whatever-you-call-it repository.
  2. A window will show up with many lines, replace pick with fixup on every line but the first one
  3. Close your editor, git should do its magic, and you should end up with one commit
  4. Use git push --force to overwrite what you already push. Don't forget the --force option otherwise git will try to merge both things together.

@oscmarb oscmarb force-pushed the verifiy-hint-defer-eager-load-is-true branch from 9aa11b7 to 7986fc6 Compare August 25, 2023 07:51
@oscmarb
Copy link
Author

oscmarb commented Aug 31, 2023

All done.

greg0ire
greg0ire previously approved these changes Aug 31, 2023
SenseException
SenseException previously approved these changes Aug 31, 2023
@greg0ire greg0ire added the Bug label Sep 1, 2023
@greg0ire greg0ire changed the base branch from 2.15.x to 2.16.x September 1, 2023 05:51
@greg0ire greg0ire dismissed stale reviews from SenseException and themself September 1, 2023 05:51

The base branch was changed.

@greg0ire greg0ire merged commit a60a273 into doctrine:2.16.x Sep 1, 2023
@greg0ire
Copy link
Member

greg0ire commented Sep 1, 2023

Thanks @oscmarb !

@greg0ire greg0ire added this to the 2.16.3 milestone Sep 1, 2023
@oscmarb oscmarb deleted the verifiy-hint-defer-eager-load-is-true branch September 1, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants