Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-3765: [GH-1419] [DDC-3382] Allow orphan removal to be cancelled #4606

Closed
doctrinebot opened this issue Jun 11, 2015 · 2 comments
Closed
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of c960657:

Url: #1419

Message:

I have a one-to-many relation with orphanRemoval=true.
If I remove an entity from the related collection and add it back, the entity is removed from the database.

$employee = $company->getEmployees()->first();
$company->getEmployees()->removeElement($employee);
$company->getEmployees()->add($employee);

$em->persist($company);
$em->flush();
// Now $employee is deleted from the database.

The expected behaviour is to leave the entity in the database, because it was present in the PersistentCollection when $em->persist() was called.

This has previously been suggested in [DDC-3382](http://www.doctrine-project.org/jira/browse/[DDC-3382]%28http://www.doctrine-project.org/jira/browse/DDC-3382%29), but it was rejected. This PR shows how small a change it is, so I hope the suggestion will be reconsidered in the light of this.

@doctrinebot
Copy link
Author

@doctrinebot
Copy link
Author

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1419] was merged:
#1419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants