Fixed MongoODM entity loader. Improved loading behavior of entities and documents by reusing entity loader.
This commit is contained in:
parent
d5a8a1009b
commit
529d99c567
@ -218,10 +218,8 @@ class EntityChoiceList extends ObjectChoiceList
|
||||
if (!$this->loaded) {
|
||||
// Optimize performance in case we have an entity loader and
|
||||
// a single-field identifier
|
||||
if ($this->idAsValue) {
|
||||
$unorderedEntities = $this->entityLoader
|
||||
? $this->entityLoader->getEntitiesByIds($this->idField, $values)
|
||||
: $this->em->getRepository($this->class)->findBy(array($this->idField => $values));
|
||||
if ($this->idAsValue && $this->entityLoader) {
|
||||
$unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values);
|
||||
$entitiesByValue = array();
|
||||
$entities = array();
|
||||
|
||||
|
@ -66,9 +66,11 @@ abstract class DoctrineType extends AbstractType
|
||||
$type = $this;
|
||||
|
||||
$loader = function (Options $options) use ($type) {
|
||||
if (null !== $options['query_builder']) {
|
||||
return $type->getLoader($options['em'], $options['query_builder'], $options['class']);
|
||||
}
|
||||
$queryBuilder = (null !== $options['query_builder'])
|
||||
? $options['query_builder']
|
||||
: $options['em']->getRepository($options['class'])->createQueryBuilder('e');
|
||||
|
||||
return $type->getLoader($options['em'], $queryBuilder, $options['class']);
|
||||
};
|
||||
|
||||
$choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) {
|
||||
|
Reference in New Issue
Block a user