Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Turn identity map collisions from exception to deprecation notice#10878

Merged
derrabus merged 1 commit into
doctrine:2.16.xfrom
mpdude:identity-map-id-collision-deprecation
Aug 4, 2023
Merged

Turn identity map collisions from exception to deprecation notice#10878
derrabus merged 1 commit into
doctrine:2.16.xfrom
mpdude:identity-map-id-collision-deprecation

Conversation

@mpdude
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

mpdude commented Aug 4, 2023

Will we need a switch for this in DoctrineBundle?

@derrabus
Copy link
Copy Markdown
Member

derrabus commented Aug 4, 2023

Yes.

@derrabus derrabus merged commit a616914 into doctrine:2.16.x Aug 4, 2023
@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