Skip to content
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

[Documentation] Add hint about disabling autowire when extending a controller #11019

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
21 changes: 11 additions & 10 deletions docs/customization/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,26 @@ getting a list of recommended products from your external api.
arguments: ['@sylius.repository.product']
public: true

**4.** Disable autowire for your controller in ``config/services.yaml``

.. code-block:: yaml

App\Controller\ProductController:
autowire: false

.. tip::

Run ``$ php bin/console debug:container sylius.repository.product`` to check if the class has changed to your implementation.
Run ``$ php bin/console debug:container sylius.controller.product`` to check if the class has changed to your implementation.

**4.** Finally you’ll need to add routes in the ``config/routes.yaml``.

.. code-block:: yaml

app_shop_custom_index:
path: /custom/index
methods: [GET]
defaults:
_controller: app.controller.shop.homepage:indexAction

app_shop_custom_custom:
path: /custom/custom
app_product_show_index:
path: /product/show
methods: [GET]
defaults:
_controller: app.controller.shop.homepage:customAction
_controller: app.controller.product:showAction

How to customize a Standard Controller?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down