1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Merge branch 'fix/#6550-correct-return-value-of-extra-lazy-removeElement-calls' into 2.5

Backport #6550 to 2.5
This commit is contained in:
Marco Pivetta 2017-07-22 09:27:30 +02:00
commit b3ceef0fb6
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629
2 changed files with 4 additions and 6 deletions

View File

@ -375,11 +375,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
$persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association);
if ($persister->removeElement($this, $element)) { return $persister->removeElement($this, $element);
return $element;
}
return null;
} }
$removed = parent::removeElement($element); $removed = parent::removeElement($element);

View File

@ -636,11 +636,13 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId); $group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
$queryCount = $this->getCurrentQueryCount(); $queryCount = $this->getCurrentQueryCount();
$user->groups->removeElement($group); $this->assertTrue($user->groups->removeElement($group));
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount(), "Removing a persisted entity should cause one query to be executed."); $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount(), "Removing a persisted entity should cause one query to be executed.");
$this->assertFalse($user->groups->isInitialized(), "Post-Condition: Collection is not initialized."); $this->assertFalse($user->groups->isInitialized(), "Post-Condition: Collection is not initialized.");
$this->assertFalse($user->groups->removeElement($group), "Removing an already removed element returns false");
// Test Many to Many removal with Entity state as new // Test Many to Many removal with Entity state as new
$group = new \Doctrine\Tests\Models\CMS\CmsGroup(); $group = new \Doctrine\Tests\Models\CMS\CmsGroup();
$group->name = "A New group!"; $group->name = "A New group!";