[PR #139] fix $isComposite semantic confusion #7767

Closed
opened 2026-01-22 15:56:44 +01:00 by admin · 0 comments
Owner

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.

**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.
admin added the pull-request label 2026-01-22 15:56:44 +01:00
admin closed this issue 2026-01-22 15:56:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7767