mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3017: UnitOfWork::$entityIdentifiers does not get updated when saving composite PK with a JoinColum as PK #3748
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?
Originally created by @doctrinebot on GitHub (Mar 8, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user rande:
The Sonata Admin Bundle rely on the
UnitOfWork::getEntityIdentifiermethod to retrieve the object identifier.We are adding support for composite PK with a FK as described in the gist: https://gist.github.com/rande/9439778 .
The bug occurs when the Material reference is updated on the Color object. The Color has a new set of PK. However the UnitOfWork::$entityIdentifiers is not updated when the object is persisted. So the values stored
UnitOfWork::$entityIdentifiersare invalid for the Color object.The consequence is that we are unable to redirect the user once the object is saved as the UnitOfWork::getEntityIdentifier refers to the old values.
@doctrinebot commented on GitHub (Mar 12, 2014):
Comment created by @ocramius:
[~rande] can you please come up with a failing test case for this issue?
@doctrinebot commented on GitHub (Mar 23, 2014):
Comment created by @beberlei:
It is not supported to change the identifier. They are assumed to be immutable by Doctrine and we cannot change that, as the consequences are impossible to handle.
@doctrinebot commented on GitHub (Mar 23, 2014):
Issue was closed with resolution "Won't Fix"
@doctrinebot commented on GitHub (Mar 31, 2014):
Comment created by rande:
Thanks for commenting this issue. So with composite keys the assumption is wrong and from your comment this bug is the expected behavior.
Now, should doctrine provide a secure method to retrieve the identifier keys ?
@doctrinebot commented on GitHub (Mar 31, 2014):
Comment created by @ocramius:
[~rande] shouldn't you extract identifiers via metadata by having an instance of an entity?
@doctrinebot commented on GitHub (Mar 31, 2014):
Comment created by rande:
It is what I did: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/master/Model/ModelManager.php#L277-L303
However it will be better to have a clean implementation in the ORM.