X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Frouting%2FLoader%2FAnnotationClassLoader.php;fp=vendor%2Fsymfony%2Frouting%2FLoader%2FAnnotationClassLoader.php;h=fd1d2b655ab292cda0a9003858e93dccca2ef275;hp=8463673e2d1ac996705a1799867799639ff34588;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php index 8463673e2..fd1d2b655 100644 --- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php @@ -57,9 +57,6 @@ use Symfony\Component\Config\Loader\LoaderResolverInterface; */ abstract class AnnotationClassLoader implements LoaderInterface { - /** - * @var Reader - */ protected $reader; /** @@ -72,11 +69,6 @@ abstract class AnnotationClassLoader implements LoaderInterface */ protected $defaultRouteIndex = 0; - /** - * Constructor. - * - * @param Reader $reader - */ public function __construct(Reader $reader) { $this->reader = $reader; @@ -127,6 +119,17 @@ abstract class AnnotationClassLoader implements LoaderInterface } } + if (0 === $collection->count() && $class->hasMethod('__invoke')) { + foreach ($this->reader->getClassAnnotations($class) as $annot) { + if ($annot instanceof $this->routeAnnotationClass) { + $globals['path'] = ''; + $globals['name'] = ''; + + $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); + } + } + } + return $collection; } @@ -136,6 +139,7 @@ abstract class AnnotationClassLoader implements LoaderInterface if (null === $name) { $name = $this->getDefaultRouteName($class, $method); } + $name = $globals['name'].$name; $defaults = array_replace($globals['defaults'], $annot->getDefaults()); foreach ($method->getParameters() as $param) { @@ -217,9 +221,14 @@ abstract class AnnotationClassLoader implements LoaderInterface 'methods' => array(), 'host' => '', 'condition' => '', + 'name' => '', ); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { + if (null !== $annot->getName()) { + $globals['name'] = $annot->getName(); + } + if (null !== $annot->getPath()) { $globals['path'] = $annot->getPath(); }