[PR #6997] ManyToManyPersister fails to remove join table entry if there is multiple join columns #10256

Open
opened 2026-01-22 16:06:58 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6997

State: closed
Merged: Yes


This is due to a typo in \Doctrine\ORM\Persisters\Collection\ManyToManyPersister::getDeleteSQLParameters:

        foreach ($mapping['relationToSourceKeyColumns'] as $columnName => $refColumnName) {
            $params[] = isset($sourceClass->fieldNames[$refColumnName])
                ? $identifier[$sourceClass->fieldNames[$refColumnName]]
                : $identifier[$sourceClass->getFieldForColumn($columnName)];
        }

It should be $sourceClass->getFieldForColumn($refColumnName), as $columnName is the join table column, not the entity table column.

**Original Pull Request:** https://github.com/doctrine/orm/pull/6997 **State:** closed **Merged:** Yes --- This is due to a typo in `\Doctrine\ORM\Persisters\Collection\ManyToManyPersister::getDeleteSQLParameters`: ```php foreach ($mapping['relationToSourceKeyColumns'] as $columnName => $refColumnName) { $params[] = isset($sourceClass->fieldNames[$refColumnName]) ? $identifier[$sourceClass->fieldNames[$refColumnName]] : $identifier[$sourceClass->getFieldForColumn($columnName)]; } ``` It should be `$sourceClass->getFieldForColumn($refColumnName)`, as `$columnName` is the join table column, not the entity table column.
admin added the pull-request label 2026-01-22 16:06:58 +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#10256