-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support defining routes on the actions via annotation #2059
Comments
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
The `Flow\Route` attribute allows to define routes directly on the affected method. This allows to avoid dealing with Routes.yaml in projects in simple cases where is sometimes is annoying to look up the exact syntax for that. Hint: While this is a very convenient way to add routes in project code it should not be used in libraries/packages that expect to be configured for the outside. In such cases the Routes.yaml is still preferred as it is easier to overwrite. Usage: ```php use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Annotations as Flow; class ExampleController extends ActionController { #[Flow\Route(uriPattern:'my/path', httpMethods: ['get'])] public function someAction(): void { } #[Flow\Route(uriPattern:'my/other/b-path', defaults: ['test' => 'b'])] #[Flow\Route(uriPattern:'my/other/c-path', defaults: ['test' => 'c'])] public function otherAction(): void { } } ``` The package: `WebSupply.RouteAnnotation` by @sorenmalling implemented similar ideas earlier. Resolves: neos#2059
Flows routing configuration is declared via The latter Creating routes by annotation must make a few assumptions to work. The routing annotation is placed at methods. The current implementation of martins pr looks like:
In https://discuss.neos.io/t/rfc-future-of-routing-mvc-in-flow/6535 we discussed that The question is how to cleanly resolve the
|
See slack thread: https://neos-project.slack.com/archives/C050KKBEB/p1593764548080600
Some excerpt quotes:
The text was updated successfully, but these errors were encountered: