final class AttributeRoutesProvider implements RoutesProviderInterface (View source)

Allows to annotate controller methods with route configurations

Internal implementation:

Flows routing configuration is declared via \@package, \@subpackage, \@controller and \@action The first three options will resolve to a fully qualified class name {\Neos\Flow\Mvc\ActionRequest::getControllerObjectName()} which is instantiated in the dispatcher {[\Neos\Flow\Mvc\Dispatcher::dispatch()}

The](../../../../Neos/Flow/Mvc/Dispatcher.html) latter \@action option will be treated internally by each controller. From the perspective of the dispatcher \@action is just another routing value. By convention during processRequest in the default ActionController {\ActionController::resolveActionMethodName()} will be used to concatenate the "Action" suffix to the action name and {\Neos\Flow\Mvc\Controller\ActionController::callActionMethod()} will invoke the method internally with prepared method arguments.

Creating routes by annotation must make a few assumptions to work:

  1. As not every FQ class name is representable via the routing configuration (e.g. the class has to end with "Controller"), only classes can be annotated that reside in a correct location and have the correct suffix. Otherwise, an exception will be thrown as the class is not discoverable by the dispatcher.

  2. As the ActionController requires a little magic and is the main use case we currently only support this controller. For that reason it is validated that the annotation is inside an ActionController and the method ends with "Action". The routing value with the suffix trimmed will be generated:

    class MyThingController extends ActionController {

    [Flow\Route(path: 'foo')]

    public function someAction()
    {
    }

    }

The example will genrate the configuration:

\@package My.Package
\@controller MyThing
\@action some

TODO for a future scope of Flow\Action see https://github.com/neos/flow-development-collection/issues/3335

Methods

__construct(ReflectionService $reflectionService, ObjectManagerInterface $objectManager, array $classNames)

No description

getRoutes()

No description

Details

__construct(ReflectionService $reflectionService, ObjectManagerInterface $objectManager, array $classNames)

No description

Parameters

ReflectionService $reflectionService
ObjectManagerInterface $objectManager
array $classNames

Routes getRoutes()

No description

Return Value

Routes