You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$msg = sprintf('The _controller value "%s:%s:%s" maps to a "%s" class, but this class was not found. Create this class or check the spelling of the class and its namespace.', $bundle, $controller, $action, $try);
84
-
}
85
-
86
-
if (count($bundles) > 1) {
87
-
$msg = sprintf('Unable to find controller "%s:%s" in bundles %s.', $bundle, $controller, implode(', ', $bundles));
thrownew \InvalidArgumentException(sprintf('The _controller value "%s:%s:%s" maps to a "%s" class, but this class was not found. Create this class or check the spelling of the class and its namespace.', $bundleName, $controller, $action, $try));
@trigger_error(sprintf('Passing "false" as the second argument to %s() is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
209
-
}
210
-
211
-
if (!isset($this->bundleMap[$name])) {
201
+
if (!isset($this->bundles[$name])) {
212
202
thrownew \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this)));
213
203
}
214
204
215
-
if (true === $first) {
216
-
return$this->bundleMap[$name][0];
217
-
}
218
-
219
-
return$this->bundleMap[$name];
205
+
return$this->bundles[$name];
220
206
}
221
207
222
208
/**
@@ -243,32 +229,27 @@ public function locateResource($name, $dir = null, $first = true)
if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) {
251
-
if (null !== $resourceBundle) {
252
-
thrownew \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.',
253
-
$file,
254
-
$resourceBundle,
255
-
$dir.'/'.$bundles[0]->getName().$overridePath
256
-
));
257
-
}
258
-
259
-
if ($first) {
260
-
return$file;
261
-
}
262
-
$files[] = $file;
235
+
if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) {
236
+
if (null !== $resourceBundle) {
237
+
thrownew \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.',
238
+
$file,
239
+
$resourceBundle,
240
+
$dir.'/'.$bundles[0]->getName().$overridePath
241
+
));
263
242
}
264
243
265
-
if (file_exists($file = $bundle->getPath().'/'.$path)) {
266
-
if ($first && !$isResource) {
267
-
return$file;
268
-
}
269
-
$files[] = $file;
270
-
$resourceBundle = $bundle->getName();
244
+
$files[] = $file;
245
+
}
246
+
247
+
if (file_exists($file = $bundle->getPath().'/'.$path)) {
248
+
if ($first && !$isResource) {
249
+
return$file;
271
250
}
251
+
$files[] = $file;
252
+
$resourceBundle = $bundle->getName();
272
253
}
273
254
274
255
if (count($files) > 0) {
@@ -393,68 +374,20 @@ public function getCharset()
393
374
}
394
375
395
376
/**
396
-
* Initializes the data structures related to the bundle management.
397
-
*
398
-
* - the bundles property maps a bundle name to the bundle instance,
399
-
* - the bundleMap property maps a bundle name to the bundle inheritance hierarchy (most derived bundle first).
377
+
* Initializes bundles.
400
378
*
401
379
* @throws \LogicException if two bundles share a common name
402
-
* @throws \LogicException if a bundle tries to extend a non-registered bundle
403
-
* @throws \LogicException if a bundle tries to extend itself
404
-
* @throws \LogicException if two bundles extend the same ancestor
405
380
*/
406
381
protectedfunctioninitializeBundles()
407
382
{
408
383
// init bundles
409
384
$this->bundles = array();
410
-
$topMostBundles = array();
411
-
$directChildren = array();
412
-
413
385
foreach ($this->registerBundles() as$bundle) {
414
386
$name = $bundle->getName();
415
387
if (isset($this->bundles[$name])) {
416
388
thrownew \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name));
417
389
}
418
390
$this->bundles[$name] = $bundle;
419
-
420
-
if ($parentName = $bundle->getParent()) {
421
-
@trigger_error('Bundle inheritance is deprecated as of 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
422
-
423
-
if (isset($directChildren[$parentName])) {
424
-
thrownew \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName]));
425
-
}
426
-
if ($parentName == $name) {
427
-
thrownew \LogicException(sprintf('Bundle "%s" can not extend itself.', $name));
428
-
}
429
-
$directChildren[$parentName] = $name;
430
-
} else {
431
-
$topMostBundles[$name] = $bundle;
432
-
}
433
-
}
434
-
435
-
// look for orphans
436
-
if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) {
437
-
$diff = array_keys($diff);
438
-
439
-
thrownew \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0]));
440
-
}
441
-
442
-
// inheritance
443
-
$this->bundleMap = array();
444
-
foreach ($topMostBundlesas$name => $bundle) {
445
-
$bundleMap = array($bundle);
446
-
$hierarchy = array($name);
447
-
448
-
while (isset($directChildren[$name])) {
449
-
$name = $directChildren[$name];
450
-
array_unshift($bundleMap, $this->bundles[$name]);
451
-
$hierarchy[] = $name;
452
-
}
453
-
454
-
foreach ($hierarchyas$hierarchyBundle) {
455
-
$this->bundleMap[$hierarchyBundle] = $bundleMap;
456
-
array_pop($bundleMap);
457
-
}
458
391
}
459
392
}
460
393
@@ -586,7 +519,6 @@ protected function getKernelParameters()
0 commit comments