diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index c2e11dfbe..a4b579b7e 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -375,11 +375,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 731a0826d..9ed16217f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php @@ -636,7 +636,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase $group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $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.");