Bläddra i källkod

[Routing] made annotation class loader more flexible

Fabien Potencier 14 år sedan
förälder
incheckning
dca8a79bf5
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5 2
      src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

+ 5 - 2
src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

@@ -116,11 +116,14 @@ abstract class AnnotationClassLoader implements LoaderInterface
                     $annot->setName($this->getDefaultRouteName($class, $method));
                 }
 
-                $defaults = array_merge($globals['defaults'], $annot->getDefaults(), $this->getRouteDefaults($class, $method, $annot));
+                $defaults = array_merge($globals['defaults'], $annot->getDefaults());
                 $requirements = array_merge($globals['requirements'], $annot->getRequirements());
                 $options = array_merge($globals['options'], $annot->getOptions());
 
                 $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options);
+
+                $this->configureRoute($route, $class, $method);
+
                 $collection->add($annot->getName(), $route);
             }
         }
@@ -163,5 +166,5 @@ abstract class AnnotationClassLoader implements LoaderInterface
     {
     }
 
-    abstract protected function getRouteDefaults(\ReflectionClass $class, \ReflectionMethod $method, RouteAnnotation $annot);
+    abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method);
 }