-
-
Notifications
You must be signed in to change notification settings - Fork 160
Fix back end route controller example #225
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @aschempp :)
Imho we should advocate the "Action Domain Responder" (ADR) pattern, especially when using __invoke
.
docs/dev/guides/backend-routes.md
Outdated
* @Route("/my-backend-route", name="app.backend-route") | ||
* @Template("my_backend_route.html.twig") | ||
* @Route("", name="app.backend-route") | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole annotation block is not needed anymore, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be removed.
docs/dev/guides/backend-routes.md
Outdated
* "_backend_module" = "my-modules" | ||
* }) | ||
* @Route("/contao//my-backend-route", | ||
* name="app.backend-route" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* name="app.backend-route" | |
* name=App\Action\BackendAction::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have never seen a route with a class name, not sure this works (and is best practice?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this works and is much more useful as you can then simply write
$this->router->generate(BackendAction::class)
in PHP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trailing comma missing after name=""
which leads to AnnotationException.php line 42: [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got 'defaults'
error
Co-Authored-By: Fritz Michael Gschwantner <fmg@inspiredminds.at>
docs/dev/guides/backend-routes.md
Outdated
* "_backend_module" = "my-modules" | ||
* }) | ||
* @Route("/contao/my-backend-route", | ||
* name="app.backend-route" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* name="app.backend-route" | |
* name=App\Controller\BackendController::class |
is there any recommendation from Symfony on how to name routes? |
docs/dev/guides/backend-routes.md
Outdated
* "_backend_module" = "my-modules" | ||
* }) | ||
* @Route("/contao//my-backend-route", | ||
* name="app.backend-route" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trailing comma missing after name=""
which leads to AnnotationException.php line 42: [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got 'defaults'
error
Currently getting error We should add the following to the services.yml (in this document). App\Controller\:
resource: ../src/Controller/*
tags:
- name: controller.service_arguments WDYT @aschempp? |
@richardhj that should not be necessary if your class extends the |
I personally prefer to not extend from the But since the example does extend, no |
docs/dev/guides/backend-routes.md
Outdated
* @Route("/my-backend-route", name="app.backend-route") | ||
* @Template("my_backend_route.html.twig") | ||
* @Route("", name="app.backend-route") | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be removed.
Why do you not prefer to extend from the |
I usually don't actually need any features from |
Thank you @aschempp |
I think the menu listener is invalid as well. @sheeep can you check if the code works?