-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Routing] Add a note for invokable controllers #6951
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
.. tip:: | ||
|
||
For referring to the ``__invoke`` method of a controller, no need for | ||
passing the method name, just use its fully-qualified namespace. |
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 think we should reword this a bit:
To refer to an action that is implemented as the
__invoke()
method of a controller class, you do not have to pass the method name, but can just use the fully qualified class name.
And we should then add an example for it imo.
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.
Maybe also move it to its own headline?
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.
👍 For reword and the example, I made the changes.
About the visibility, IMHO we should stay consistent with the controllers as a service
note above, don't you think it's enough as is?
1a30691
to
e0fa4ad
Compare
e0fa4ad
to
0b046b3
Compare
In the note below it's referencing to Controller as a Service. When using Controller as a Service, you simply refer to the service id: |
@iltar The note redirects to a dedicated section which already document that https://github.com/symfony/symfony-docs/blob/master/controller/service.rst#referring-to-the-service |
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 @chalasr. |
This PR was merged into the 2.7 branch. Discussion ---------- [Routing] Add a note for invokable controllers Since this feature can help to avoid defining controllers as services or writing `Controller::__invoke` when it's not needed, I think we should document it. Commits ------- 0b046b3 [Routing] Add a note for refering invokable controllers
Since this feature can help to avoid defining controllers as services or writing
Controller::__invoke
when it's not needed, I think we should document it.