Skip to content

[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

Merged
merged 1 commit into from
May 17, 2017

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Sep 2, 2016

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.

@chalasr chalasr changed the title [Routing] Add a note for refering invokable controllers [Routing] Add a note for invokable controllers Sep 16, 2016
.. tip::

For referring to the ``__invoke`` method of a controller, no need for
passing the method name, just use its fully-qualified namespace.
Copy link
Member

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.

Copy link
Member

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?

Copy link
Member Author

@chalasr chalasr Sep 22, 2016

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?

@chalasr chalasr force-pushed the invokable_controllers branch from 1a30691 to e0fa4ad Compare September 22, 2016 22:48
@chalasr chalasr force-pushed the invokable_controllers branch from e0fa4ad to 0b046b3 Compare September 28, 2016 19:47
@linaori
Copy link
Contributor

linaori commented Oct 16, 2016

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: app.controller.foo:__invoke would be app.controller.foo.

@chalasr
Copy link
Member Author

chalasr commented Oct 17, 2016

@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

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@xabbuh
Copy link
Member

xabbuh commented May 17, 2017

Thank you @chalasr.

@xabbuh xabbuh merged commit 0b046b3 into symfony:2.7 May 17, 2017
xabbuh added a commit that referenced this pull request May 17, 2017
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
@chalasr chalasr deleted the invokable_controllers branch May 17, 2017 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants