DDC-2585: Persisting the owning side will not set the inverse side relationship #3247

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

Originally created by @doctrinebot on GitHub (Jul 31, 2013).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user naroga:

Adding items to the owning side of a bidirectional relationship should be enough to set the items' relationship to its owner. Instead, as of now we still have to manually set both sides, be it on the entity itself or on your controller/service code.

Example:

$owning->addObject($inverse);

Doctrine should execute $inverse->setOwner($owning) when flushing $owning. Right now we have to run $owning->addObject($inverse) and $inverse->setOwner($owning) manually, which makes no sense, since Owner entity is configured to cascade persist operations.

Originally created by @doctrinebot on GitHub (Jul 31, 2013). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user naroga: Adding items to the owning side of a bidirectional relationship should be enough to set the items' relationship to its owner. Instead, as of now we still have to manually set both sides, be it on the entity itself or on your controller/service code. Example: $owning->addObject($inverse); Doctrine should execute $inverse->setOwner($owning) when flushing $owning. Right now we have to run $owning->addObject($inverse) and $inverse->setOwner($owning) manually, which makes no sense, since Owner entity is configured to cascade persist operations.
admin added the Bug label 2026-01-22 14:16:33 +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#3247