Skip to content

Replace service name with FQCN class reference #17600

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
Dec 22, 2022
Merged
Changes from all commits
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
14 changes: 8 additions & 6 deletions controller/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ a service like: ``App\Controller\HelloController::index``:

# config/routes.yaml
hello:
path: /hello
path: /hello
controller: App\Controller\HelloController::index
methods: GET
methods: GET

.. code-block:: xml

Expand Down Expand Up @@ -181,8 +181,8 @@ which is a common practice when following the `ADR pattern`_

# config/routes.yaml
hello:
path: /hello/{name}
controller: app.hello_controller
path: /hello/{name}
controller: App\Controller\HelloController

.. code-block:: xml

Expand All @@ -194,16 +194,18 @@ which is a common practice when following the `ADR pattern`_
https://symfony.com/schema/routing/routing-1.0.xsd">

<route id="hello" path="/hello/{name}">
<default key="_controller">app.hello_controller</default>
<default key="_controller">App\Controller\HelloController</default>
</route>

</routes>

.. code-block:: php

use App\Controller\HelloController;

// app/config/routing.php
$collection->add('hello', new Route('/hello', [
'_controller' => 'app.hello_controller',
'_controller' => HelloController::class,
]));

Alternatives to base Controller Methods
Expand Down