From fc6b5a10749dcd7c10442d897c84d365ac61d05f Mon Sep 17 00:00:00 2001 From: Arnaud Langlade Date: Sat, 10 May 2014 18:12:28 +0200 Subject: [PATCH] The criteria don't care about empties values --- Doctrine/ORM/EntityRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doctrine/ORM/EntityRepository.php b/Doctrine/ORM/EntityRepository.php index 717b154e096..b86bc14ce6d 100644 --- a/Doctrine/ORM/EntityRepository.php +++ b/Doctrine/ORM/EntityRepository.php @@ -161,12 +161,12 @@ protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = n if (null === $value) { $queryBuilder ->andWhere($queryBuilder->expr()->isNull($this->getPropertyName($property))); - } elseif (!is_array($value)) { + } elseif (is_array($value)) { + $queryBuilder->andWhere($queryBuilder->expr()->in($this->getPropertyName($property), $value)); + } elseif ('' !== $value) { $queryBuilder ->andWhere($queryBuilder->expr()->eq($this->getPropertyName($property), ':' . $property)) ->setParameter($property, $value); - } else { - $queryBuilder->andWhere($queryBuilder->expr()->in($this->getPropertyName($property), $value)); } } }