-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Description
Since the AnnotationFileLoader loads annotation on one class per file (which is a PSR recommendation) the framework may be able to load annotations from multiple class in the same file (may be usefull in same cases like a DefaultController with default actions ...)
The idea here is to add a AnnotationMultipleClassFileLoader with annotations type key to support multiple class per file declaration
Example
<?php
namespace App;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(path="/", name="home")
*/
class IndexController
{
public function __invoke()
{
return __METHOD__;
}
}
class TestController
{
/**
* @Route(path="/test.{format}", name="test", requirements={"format": "\w+"}, defaults={"format": "html"})
*/
public function test()
{
return __METHOD__;
}
/**
* @Route(path="/test1.{format}", name="test1", requirements={"format": "\w+"}, defaults={"format": "html"})
*/
public function test1()
{
return __METHOD__;
}
}AnnotationFileLoader Vs AnnotationMultipleClassFileLoader :
The first dump Annotation file is loaded with AnnotationFileLoader while the second Annotation file multiple class is loaded with AnnotationMultipleClassFileLoader :
chapterjason
