mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Versioned entity with composite id with foreign key can't be updated separately #5737
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 @etki on GitHub (Oct 12, 2017).
Originally assigned to: @ostrolucky on GitHub.
Hi! I'm hitting a rare issue with many-to-one mapping.
Imagine following relationship:
I can persist root with children, but this is what happens when i persist child separately:
UnitOfWork.createEntityis called, which extracts id throughIdentifierFlatteneras[root: <uuid>, index: <integer>]UnitOfWork.commit()is calledBasicEntityPersister.update(entity)is called.updateTableis successfully called, all ok here$this->em->getUnitOfWork()->getEntityIdentifier($entity), which is already flattened and contains root key instead of root_id (BasicEntityPersister:369)BasicEntityPersister.fetchVersionValue, which callsIdentifierFlattener.flattenIdentifieragain.flattenIdentifieris fed with already-flattened identifier, while it expects to findroot_idin passed array so it throws an errorDoctrine version: v2.5.11 - this report may be already out-of-date
@lcobucci commented on GitHub (Oct 29, 2017):
@etki could you please send us a failing test case that reproduces that behaviour? It would help us a lot to identify and fix the issue you're describing.
You can find examples on
388afb46d0/tests/Doctrine/Tests/ORM/Functional/Ticket@ostrolucky commented on GitHub (Aug 6, 2018):
Closing due to lack of feedback. If you can still reproduce in latest version, feel free to reopen.
@TsungHseinTsai commented on GitHub (Nov 5, 2020):
I hit the same issue.
An entity that has association primary key and versioned column will fail on updating if the variable nam of the association PK is different with column name. Just like Etki's entity example.
Doctrine version: v2.6.6