From 260cc6e3e0972b55a1419dfcfb55c4dcc26cbb9e Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 13 Jul 2017 08:16:00 +0200 Subject: [PATCH] Fix return of removeElement on collections Fixes #5745 --- lib/Doctrine/ORM/PersistentCollection.php | 6 +----- .../Tests/ORM/Functional/ExtraLazyCollectionTest.php | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index a5024b8d9..2210c3c31 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -373,11 +373,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); - if ($persister->removeElement($this, $element)) { - return $element; - } - - return null; + return $persister->removeElement($this, $element); } $removed = parent::removeElement($element); diff --git a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php index dc090a055..7f18aaca0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php @@ -640,7 +640,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase $group = $this->_em->find(CmsGroup::class, $this->groupId); $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->assertFalse($user->groups->isInitialized(), "Post-Condition: Collection is not initialized.");