From 21858835201c940e79da1e95658a6ead8e5275ba Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Thu, 5 Feb 2015 17:41:00 +0000 Subject: [PATCH] Optimize EntityType by only loading choices for values in the same way that EntityLoader customization does (if you provide a query_builder). --- .../Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php index 57e57e6e25db9..50460de5777ef 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(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy