Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Document FQCN named controllers #7771

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor reword
  • Loading branch information
javiereguiluz authored and GuilhemN committed May 5, 2017
commit 14f89d761c59a879251b5170d6ad5bf8b715399f
14 changes: 6 additions & 8 deletions 14 controller/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ Then you can define it as a service as follows:
Referring to the Service
------------------------

If the fully-qualified class name (FQCN) of your controller is also the id of
your service then you can refer to your controller using the usual notations.
For example, to forward to the ``indexAction()`` method of the service
defined above with the id ``AppBundle\Controller\HelloController``::
If the service id is the fully-qualified class name (FQCN) of your controller,
you can keep using the usual notation. For example, to forward to the
``indexAction()`` method of the above ``AppBundle\Controller\HelloController``
service::

$this->forward('AppBundle:Hello:index', array('name' => $name));
Copy link
Contributor

Choose a reason for hiding this comment

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

Although I don't get why this is related to the fact that we use a FQCN as id.

Copy link
Contributor Author

@GuilhemN GuilhemN Apr 12, 2017

Choose a reason for hiding this comment

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

Because this doesn't work with other service ids (fqcn named services are managed differently https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php#L70).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok got it too :).


To refer to a controller that's defined as a service whose ID is not your
controller fully-qualified class name (FQCN), use the single colon (:)
notation. For example, to forward to the ``indexAction()`` method of a service
defined with the id ``app.hello_controller``::
Otherwise, use the single colon (``:``) notation. For example, to forward to the
``indexAction()`` method of a service with the id ``app.hello_controller``::

$this->forward('app.hello_controller:indexAction', array('name' => $name));

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.