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

Hotfix/#1169 extra lazy one to many should not delete referenced entities #1281

Conversation

Ocramius
Copy link
Member

This is an alternate fix for #1169 (DDC-3343 http://www.doctrine-project.org/jira/browse/DDC-3343)

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DDC-3536

We use Jira to track the state of pull requests and the versions they got
included in.

@stof
Copy link
Member

stof commented Jan 24, 2015

looks good to me

@Ocramius
Copy link
Member Author

@stof I'll provide a 2.4 PR as well in a few.

/**
* @group DDC-3343
*/
public function testRemovesManagedElementFromOneToManyExtraLazyCollection()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are actually on the wrong file.

*
* @param PersistentCollection $collection
*/
protected function evictCollectionCache(PersistentCollection $collection)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured that none of the EXTRA_LAZY stuff was actually updating the collection-related caches. This change fixes that

Ocramius added a commit that referenced this pull request Jan 25, 2015
…-many-should-not-delete-referenced-entities

Hotfix/#1169 extra lazy one to many should not delete referenced entities
@Ocramius Ocramius merged commit 5bf1829 into doctrine:master Jan 25, 2015
@Ocramius Ocramius deleted the hotfix/#1169-extra-lazy-one-to-many-should-not-delete-referenced-entities branch January 25, 2015 04:43
@@ -163,7 +164,20 @@ public function removeElement(PersistentCollection $collection, $element)
$mapping = $collection->getMapping();
$persister = $this->uow->getEntityPersister($mapping['targetEntity']);

return $persister->delete($element);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was intended to be used only be used with orphanRemoval=true, not always like it is now.

@Ocramius
Copy link
Member Author

To recap, I need to fix following:

  • when using orphan-removal, this triggers a DELETE operation on the inverse side
  • when not using orphan-removal, this becomes no-op.

@Ocramius
Copy link
Member Author

Provided required hotfixes via #1288

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

Successfully merging this pull request may close these issues.

5 participants