From b5ba84f667223145d041f6754564ea9e3a4fb6fc Mon Sep 17 00:00:00 2001 From: Oliver Tischlinger Date: Thu, 4 Dec 2014 15:57:10 +0100 Subject: [PATCH] matching should not change critera The matching should behave like in ArrayCollection, where it is not changed. The criteria should be cloned so that it could be used for more than one matching operation. --- lib/Doctrine/ORM/PersistentCollection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index c79130c65..4a56230df 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -878,6 +878,7 @@ final class PersistentCollection implements Collection, Selectable $expression = $criteria->getWhereExpression(); $expression = $expression ? $builder->andX($expression, $ownerExpression) : $ownerExpression; + $criteria = clone $critera; $criteria->where($expression); $persister = $this->em->getUnitOfWork()->getEntityPersister($this->association['targetEntity']);