@@ -126,12 +126,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
126
126
127
127
public function configureOptions (OptionsResolver $ resolver )
128
128
{
129
- $ registry = $ this ->registry ;
130
- $ choiceListFactory = $ this ->choiceListFactory ;
131
- $ idReaders = &$ this ->idReaders ;
132
- $ choiceLoaders = &$ this ->choiceLoaders ;
133
-
134
- $ choiceLoader = function (Options $ options ) use ($ choiceListFactory , &$ choiceLoaders , $ type ) {
129
+ $ choiceLoader = function (Options $ options ) {
135
130
// Unless the choices are given explicitly, load them on demand
136
131
if (null === $ options ['choices ' ]) {
137
132
@@ -141,7 +136,7 @@ public function configureOptions(OptionsResolver $resolver)
141
136
// If there is no QueryBuilder we can safely cache DoctrineChoiceLoader,
142
137
// also if concrete Type can return important QueryBuilder parts to generate
143
138
// hash key we go for it as well
144
- if (!$ options ['query_builder ' ] || false !== ($ qbParts = $ type ->getQueryBuilderPartsForCachingHash ($ options ['query_builder ' ]))) {
139
+ if (!$ options ['query_builder ' ] || false !== ($ qbParts = $ this ->getQueryBuilderPartsForCachingHash ($ options ['query_builder ' ]))) {
145
140
146
141
$ hash = CachingFactoryDecorator::generateHash (array (
147
142
$ options ['em ' ],
@@ -150,8 +145,8 @@ public function configureOptions(OptionsResolver $resolver)
150
145
$ options ['loader ' ],
151
146
));
152
147
153
- if (isset ($ choiceLoaders [$ hash ])) {
154
- return $ choiceLoaders [$ hash ];
148
+ if (isset ($ this -> choiceLoaders [$ hash ])) {
149
+ return $ this -> choiceLoaders [$ hash ];
155
150
}
156
151
}
157
152
@@ -165,15 +160,15 @@ public function configureOptions(OptionsResolver $resolver)
165
160
}
166
161
167
162
$ doctrineChoiceLoader = new DoctrineChoiceLoader (
168
- $ choiceListFactory ,
163
+ $ this -> choiceListFactory ,
169
164
$ options ['em ' ],
170
165
$ options ['class ' ],
171
166
$ options ['id_reader ' ],
172
167
$ entityLoader
173
168
);
174
169
175
170
if ($ hash !== null ) {
176
- $ choiceLoaders [$ hash ] = $ doctrineChoiceLoader ;
171
+ $ this -> choiceLoaders [$ hash ] = $ doctrineChoiceLoader ;
177
172
}
178
173
179
174
return $ doctrineChoiceLoader ;
@@ -220,17 +215,17 @@ public function configureOptions(OptionsResolver $resolver)
220
215
// Otherwise, an incrementing integer is used as value automatically
221
216
};
222
217
223
- $ emNormalizer = function (Options $ options , $ em ) use ( $ registry ) {
218
+ $ emNormalizer = function (Options $ options , $ em ) {
224
219
/* @var ManagerRegistry $registry */
225
220
if (null !== $ em ) {
226
221
if ($ em instanceof ObjectManager) {
227
222
return $ em ;
228
223
}
229
224
230
- return $ registry ->getManager ($ em );
225
+ return $ this -> registry ->getManager ($ em );
231
226
}
232
227
233
- $ em = $ registry ->getManagerForClass ($ options ['class ' ]);
228
+ $ em = $ this -> registry ->getManagerForClass ($ options ['class ' ]);
234
229
235
230
if (null === $ em ) {
236
231
throw new RuntimeException (sprintf (
@@ -273,7 +268,7 @@ public function configureOptions(OptionsResolver $resolver)
273
268
274
269
// Set the "id_reader" option via the normalizer. This option is not
275
270
// supposed to be set by the user.
276
- $ idReaderNormalizer = function (Options $ options ) use (& $ idReaders ) {
271
+ $ idReaderNormalizer = function (Options $ options ) {
277
272
$ hash = CachingFactoryDecorator::generateHash (array (
278
273
$ options ['em ' ],
279
274
$ options ['class ' ],
@@ -285,12 +280,12 @@ public function configureOptions(OptionsResolver $resolver)
285
280
// of the field, so we store that information in the reader.
286
281
// The reader is cached so that two choice lists for the same class
287
282
// (and hence with the same reader) can successfully be cached.
288
- if (!isset ($ idReaders [$ hash ])) {
283
+ if (!isset ($ this -> idReaders [$ hash ])) {
289
284
$ classMetadata = $ options ['em ' ]->getClassMetadata ($ options ['class ' ]);
290
- $ idReaders [$ hash ] = new IdReader ($ options ['em ' ], $ classMetadata );
285
+ $ this -> idReaders [$ hash ] = new IdReader ($ options ['em ' ], $ classMetadata );
291
286
}
292
287
293
- return $ idReaders [$ hash ];
288
+ return $ this -> idReaders [$ hash ];
294
289
};
295
290
296
291
$ resolver ->setDefaults (array (
0 commit comments