mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #420] [CLOSED] Cascade dependent identities to associations #8161
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?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/420
Author: @djlambert
Created: 8/8/2012
Status: ❌ Closed
Base:
master← Head:CascadeDependantId📝 Commits (3)
801c742When cascading associations check if associated entity's identity is dependant and null, if so set identity.8ed434bIf associated entity is one-to-one and cascade persist check if identifier is dependant and set if null.1d36dd2Tests for cascading dependant identities to associations.📊 Changes
2 files changed (+377 additions, -0 deletions)
View changed files
📝
lib/Doctrine/ORM/UnitOfWork.php(+19 -0)➕
tests/Doctrine/Tests/ORM/Functional/CascadeDependantIdentityTest.php(+358 -0)📄 Description
Currently when an entity in a one-to-one association gets its identity from another entity it requires calling the setter for the associated entity from the setter in the identity source entity setter or passing the identity source entity to the associated entity's constructer, something similar to this:
This PR adds checks for associations with cascade persist that have dependent identities which are empty, and sets the field in the associated entity to the identity source entity. Granted it's not complicated to do as the previous example, but this allows for simpler code. It also seems a logical assumption that when the association is cascade persist this should happen automatically:
Now only if it wasn't so wordy to explain :)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.