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

Turn identity map collisions from exception to deprecation notice #10878

Merged

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Aug 3, 2023

In #10785, a check was added that prevents entity instances from getting into the identity map when another object for the same ID is already being tracked.

This caused regressions for users that work with application-provided IDs and expect this condition to fail with UniqueConstraintViolationExceptions when flushing to the database.

Thus, this PR turns the exception into a deprecation notice. Users can opt-in to the new behavior. In 3.0, the exception will be used.

Implements #10871.

In doctrine#10785, a check was added that prevents entity instances from getting into the identity map when another object for the same ID is already being tracked.

This caused regressions for users that work with application-provided IDs and expect this condition to fail with `UniqueConstraintViolationExceptions` when flushing to the database.

Thus, this PR turns the exception into a deprecation notice. Users can opt-in to the new behavior. In 3.0, the exception will be used.

Implements doctrine#10871.
@mpdude mpdude force-pushed the identity-map-id-collision-deprecation branch from 2f206fd to 588a200 Compare August 4, 2023 08:42
@derrabus derrabus added this to the 2.16.1 milestone Aug 4, 2023
@derrabus derrabus added the Bug label Aug 4, 2023
@derrabus derrabus linked an issue Aug 4, 2023 that may be closed by this pull request
@mpdude
Copy link
Contributor Author

mpdude commented Aug 4, 2023

Will we need a switch for this in DoctrineBundle?

@derrabus
Copy link
Member

derrabus commented Aug 4, 2023

Yes.

@derrabus derrabus merged commit a616914 into doctrine:2.16.x Aug 4, 2023
41 checks passed
@mpdude mpdude deleted the identity-map-id-collision-deprecation branch August 4, 2023 15:40
derrabus added a commit that referenced this pull request Aug 7, 2023
* 2.16.x:
  Turn identity map collisions from exception to deprecation notice (#10878)
  Add possibility to set reportFieldsWhereDeclared to true in ORMSetup (#10865)
  Fix UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet  (#9301)
  Add an UPGRADE notice about the potential changes in commit order (#10866)
  Update branch metadata (#10862)
nicolas-grekas pushed a commit to nicolas-grekas/doctrine-orm that referenced this pull request Aug 7, 2023
…ctrine#10878)

In doctrine#10785, a check was added that prevents entity instances from getting into the identity map when another object for the same ID is already being tracked.

This caused regressions for users that work with application-provided IDs and expect this condition to fail with `UniqueConstraintViolationExceptions` when flushing to the database.

Thus, this PR turns the exception into a deprecation notice. Users can opt-in to the new behavior. In 3.0, the exception will be used.

Implements doctrine#10871.
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.

Add a feature flag for the exception added in #10785
2 participants