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) {
|
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) {
|
if ($this->idAsValue && $this->entityLoader) {
|
||||||
$unorderedEntities = $this->entityLoader
|
$unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values);
|
||||||
? $this->entityLoader->getEntitiesByIds($this->idField, $values)
|
|
||||||
: $this->em->getRepository($this->class)->findBy(array($this->idField => $values));
|
|
||||||
$entitiesByValue = array();
|
$entitiesByValue = array();
|
||||||
$entities = array();
|
$entities = array();
|
||||||
|
|
||||||
|
@ -66,9 +66,11 @@ abstract class DoctrineType extends AbstractType
|
|||||||
$type = $this;
|
$type = $this;
|
||||||
|
|
||||||
$loader = function (Options $options) use ($type) {
|
$loader = function (Options $options) use ($type) {
|
||||||
if (null !== $options['query_builder']) {
|
$queryBuilder = (null !== $options['query_builder'])
|
||||||
return $type->getLoader($options['em'], $options['query_builder'], $options['class']);
|
? $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) {
|
$choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) {
|
||||||
|
Reference in New Issue
Block a user