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
7b9bc804e7
commit
a10844587b
@ -218,8 +218,10 @@ class EntityChoiceList extends ObjectChoiceList
|
|||||||
if (!$this->loaded) {
|
if (!$this->loaded) {
|
||||||
// Optimize performance in case we have an entity loader and
|
// Optimize performance in case we have an entity loader and
|
||||||
// a single-field identifier
|
// a single-field identifier
|
||||||
if ($this->idAsValue && $this->entityLoader) {
|
if ($this->idAsValue) {
|
||||||
$unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values);
|
$unorderedEntities = $this->entityLoader
|
||||||
|
? $this->entityLoader->getEntitiesByIds($this->idField, $values)
|
||||||
|
: $this->em->getRepository($this->class)->findBy(array($this->idField => $values));
|
||||||
$entitiesByValue = array();
|
$entitiesByValue = array();
|
||||||
$entities = array();
|
$entities = array();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user