mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #139] fix $isComposite semantic confusion #7767
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?
Original Pull Request: https://github.com/doctrine/orm/pull/139
State: closed
Merged: No
Working on a many to many relationship, we found a semantic confusion resulting in a bug:
We have a table A, single PK(A_1) and table B, composite PK(B_1, B_2)
We define a many to many relationship involving A_1 and B_1 (not B_2).
We build the schema, everything is OK.
But when adding to the collection of B in a A entity (A->addToBCollection(...)), then the ManyToManyPersister is buggy, because what is currently named $isComposite has in fact nothing to do with composite primary keys. array_pop() is used as if $identifier1 (or 2) is a single element array, but that is not the case for us, leading to the "popping" of the last column of the composite PK, which is invalid.
This patch makes less assumptions and fixes the bug.