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

Explain EntityManager::getReference() peculiarities #10800

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Jun 25, 2023

As one takeaway from #3037 (comment) and #843, we should look into better explaining the EntityManager::getReference() method, it’s semantics, caveats and potential responsibilities placed on the user.

This PR tries to do that, so it fixes #10797.

@mpdude
Copy link
Contributor Author

mpdude commented Jun 25, 2023

As a side note, I noticed the getReference() method and proxies are mentioned in the "advanced configuration" section only.

That seems strange, I don't see what that topic has to do with it.

WDYT about having a dedicated page for proxies or moving that topic elsewhere?

As one takeaway from doctrine#3037 (comment) and doctrine#843, we should look into better explaining the `EntityManager::getReference()` method, it’s semantics, caveats and potential responsibilities placed on the user.

This PR tries to do that, so it fixes doctrine#10797.
@greg0ire
Copy link
Member

WDYT about having a dedicated page for proxies or moving that topic elsewhere?

Makes sense to me 👍

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
@SenseException SenseException merged commit 4aadba6 into doctrine:2.15.x Jun 26, 2023
@mpdude mpdude deleted the fix-10797 branch June 27, 2023 05:30
@derrabus derrabus added this to the 2.15.4 milestone Jun 27, 2023
nicolas-grekas added a commit to nicolas-grekas/doctrine-orm that referenced this pull request Jul 7, 2023
* 2.15.x: (23 commits)
  Fix cloning entities when using lazy-ghost proxies
  Fixes recomputation of single entity change set when entity contains enum attributes. Due to the fact that originalEntityData contains enum objects and ReflectionEnumProperty::getValue() returns value of enum, comparison of values are always falsy, resulting to update columns value even though it has not changes.
  Fix code style issues
  Use absolute references
  Avoid colon followed by double colon
  Use correct syntax for references
  Fix invalid reference syntax
  Use rst syntax
  Use internal link
  Escape pipes
  Introduce new workflow to test docs
  Remove lone dash (doctrine#10812)
  Treat id field proprites same as regular field
  Move three "Ticket/"-style tests to the right namespace
  Follow recommendation about multiline type
  Fix unserialize() errors when running tests on PHP 8.3 (doctrine#10803)
  Explain `EntityManager::getReference()` peculiarities (doctrine#10800)
  Upgrade to Psalm 5.13
  test: assert `postLoad` has data first
  distinct() updates QueryBuilder state correctly
  ...
nicolas-grekas added a commit to nicolas-grekas/doctrine-orm that referenced this pull request Jul 7, 2023
* 2.15.x: (23 commits)
  Fix cloning entities when using lazy-ghost proxies
  Fixes recomputation of single entity change set when entity contains enum attributes. Due to the fact that originalEntityData contains enum objects and ReflectionEnumProperty::getValue() returns value of enum, comparison of values are always falsy, resulting to update columns value even though it has not changes.
  Fix code style issues
  Use absolute references
  Avoid colon followed by double colon
  Use correct syntax for references
  Fix invalid reference syntax
  Use rst syntax
  Use internal link
  Escape pipes
  Introduce new workflow to test docs
  Remove lone dash (doctrine#10812)
  Treat id field proprites same as regular field
  Move three "Ticket/"-style tests to the right namespace
  Follow recommendation about multiline type
  Fix unserialize() errors when running tests on PHP 8.3 (doctrine#10803)
  Explain `EntityManager::getReference()` peculiarities (doctrine#10800)
  Upgrade to Psalm 5.13
  test: assert `postLoad` has data first
  distinct() updates QueryBuilder state correctly
  ...
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.

Better explain the EntityManager::getReference() method
4 participants