File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -218,10 +218,8 @@ public function getChoicesForValues(array $values)
218
218
if (!$ this ->loaded ) {
219
219
// Optimize performance in case we have an entity loader and
220
220
// a single-field identifier
221
- if ($ this ->idAsValue ) {
222
- $ unorderedEntities = $ this ->entityLoader
223
- ? $ this ->entityLoader ->getEntitiesByIds ($ this ->idField , $ values )
224
- : $ this ->em ->getRepository ($ this ->class )->findBy (array ($ this ->idField => $ values ));
221
+ if ($ this ->idAsValue && $ this ->entityLoader ) {
222
+ $ unorderedEntities = $ this ->entityLoader ->getEntitiesByIds ($ this ->idField , $ values );
225
223
$ entitiesByValue = array ();
226
224
$ entities = array ();
227
225
Original file line number Diff line number Diff line change @@ -66,9 +66,11 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
66
66
$ type = $ this ;
67
67
68
68
$ loader = function (Options $ options ) use ($ type ) {
69
- if (null !== $ options ['query_builder ' ]) {
70
- return $ type ->getLoader ($ options ['em ' ], $ options ['query_builder ' ], $ options ['class ' ]);
71
- }
69
+ $ queryBuilder = (null !== $ options ['query_builder ' ])
70
+ ? $ options ['query_builder ' ]
71
+ : $ options ['em ' ]->getRepository ($ options ['class ' ])->createQueryBuilder ('e ' );
72
+
73
+ return $ type ->getLoader ($ options ['em ' ], $ queryBuilder , $ options ['class ' ]);
72
74
};
73
75
74
76
$ choiceList = function (Options $ options ) use (&$ choiceListCache , $ propertyAccessor ) {
You can’t perform that action at this time.
0 commit comments