DDC-3498: orphanRemoval=true for One-To-Many Bidirectional associations (without Join Table) produces unnecessary number of DELETE queries #4307

Open
opened 2026-01-22 14:39:12 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Jan 14, 2015).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user alexprokop:

If orphanRemoval=true is set on a One-To-Many Bidirectional association without a Join Table, when removing the owning entity, multiple DELETE queries are generated. Since the row in the database on the Many-To-One side contains both the association and entity data, it should be possible to replace this with a single DELETE query using the owning entity's id, as when deleting associations in a Join Table for a Many-To-Many association. See attachment for example code.

Originally created by @doctrinebot on GitHub (Jan 14, 2015). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user alexprokop: If orphanRemoval=true is set on a One-To-Many Bidirectional association without a Join Table, when removing the owning entity, multiple DELETE queries are generated. Since the row in the database on the Many-To-One side contains both the association and entity data, it should be possible to replace this with a single DELETE query using the owning entity's id, as when deleting associations in a Join Table for a Many-To-Many association. See attachment for example code.
admin added the Improvement label 2026-01-22 14:39:12 +01:00
Author
Owner
@doctrinebot commented on GitHub (Jan 14, 2015): - is referenced by [DDC-3497: orphanRemoval=true overrides onDelete="CASCADE" behaviour for One-To-Many Bidirectional associations (without Join Table)](http://www.doctrine-project.org/jira/browse/DDC-3497)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4307