Optimize EntityType by only loading choices for values in the same way that EntityLoader customization does (if you provide a query_builder).
This commit is contained in:
parent
542f60457d
commit
2185883520
|
@ -218,8 +218,10 @@ class EntityChoiceList extends ObjectChoiceList
|
|||
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();
|
||||
|
||||
|
|
Reference in New Issue