mirror of
https://github.com/doctrine/KeyValueStore.git
synced 2026-03-24 08:42:12 +01:00
[PR #30] [MERGED] Bugfix: UoW should properly handle entities of different classes #59
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/doctrine/KeyValueStore/pull/30
Author: @TheDistantSea
Created: 7/24/2015
Status: ✅ Merged
Merged: 7/24/2015
Merged by: @beberlei
Base:
master← Head:unit-of-work-identity-map-fixes📝 Commits (1)
bcf6d01Bugfix: UoW now properly handles entities of different classes📊 Changes
1 file changed (+30 additions, -28 deletions)
View changed files
📝
lib/Doctrine/KeyValueStore/UnitOfWork.php(+30 -28)📄 Description
An
EntityManageris responsible for handling entities of all types and aggregates a singleUnitOfWorkmember for its lifetime.This means
UnitOfWorkitself must be able to handle entities of all types, which unfortunately it cannot. The reason is that out of its internal mapping structures,$identityMapuses normalized entity keys as array keys and therefore gets confused in the presence of entities of unrelated classes that have identical normalized primary keys -- for example, unrelatedUserandGroupentities with the same single-column PKid, when the unit of work encounters aUserand aGroupthat happen to also have the same value forid.This PR fixes the issue by adding another level of mapping based on the entity class name, just like Doctrine's
UnitOfWorkimplementation.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.