File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
src/Symfony/Bridge/Doctrine/Form Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public function transform($collection)
5252
5353 foreach ($ collection as $ entity ) {
5454 // identify choices by their collection key
55- $ key = array_search ($ entity , $ availableEntities );
55+ $ key = array_search ($ entity , $ availableEntities, true );
5656 $ array [] = $ key ;
5757 }
5858 } else {
Original file line number Diff line number Diff line change 2222
2323class EntityType extends AbstractType
2424{
25+ /**
26+ * @var ManagerRegistry
27+ */
2528 protected $ registry ;
2629
2730 public function __construct (ManagerRegistry $ registry )
@@ -58,11 +61,7 @@ public function getDefaultOptions(array $options)
5861 if (!isset ($ options ['choice_list ' ])) {
5962 $ manager = $ this ->registry ->getManager ($ options ['em ' ]);
6063 if (isset ($ options ['query_builder ' ])) {
61- $ options ['loader ' ] = new ORMQueryBuilderLoader (
62- $ options ['query_builder ' ],
63- $ manager ,
64- $ options ['class ' ]
65- );
64+ $ options ['loader ' ] = $ this ->getLoader ($ manager , $ options );
6665 }
6766
6867 $ defaultOptions ['choice_list ' ] = new EntityChoiceList (
@@ -78,6 +77,22 @@ public function getDefaultOptions(array $options)
7877 return $ defaultOptions ;
7978 }
8079
80+ /**
81+ * Return the default loader object.
82+ *
83+ * @param ObjectManager
84+ * @param array $options
85+ * @return ORMQueryBuilderLoader
86+ */
87+ protected function getLoader ($ manager , $ options )
88+ {
89+ return new ORMQueryBuilderLoader (
90+ $ options ['query_builder ' ],
91+ $ manager ,
92+ $ options ['class ' ]
93+ );
94+ }
95+
8196 public function getParent (array $ options )
8297 {
8398 return 'choice ' ;
You can’t perform that action at this time.
0 commit comments