diff --git a/Doctrine/ORM/EntityRepository.php b/Doctrine/ORM/EntityRepository.php index 21aa018e664..8ac36ee837c 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)); } } }