diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php index 964fbdc9354a..873e4b025e0f 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php @@ -218,8 +218,10 @@ public function getChoicesForValues(array $values) if (!$this->loaded) { // Optimize performance in case we have an entity loader and // a single-field identifier - if ($this->idAsValue && $this->entityLoader) { - $unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values); + if ($this->idAsValue) { + $unorderedEntities = $this->entityLoader + ? $this->entityLoader->getEntitiesByIds($this->idField, $values) + : $this->em->getRepository($this->class)->findBy(array($this->idField => $values)); $entitiesByValue = array(); $entities = array();