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

[DOCS] Updating the controller customization #12338

Merged
merged 2 commits into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/customization/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ getting a list of recommended products from your external api.

.. tip::

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

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

Expand All @@ -124,7 +124,7 @@ getting a list of recommended products from your external api.
path: /product/show
methods: [GET]
defaults:
_controller: sylius.controller.product:showAction
_controller: sylius.controller.product::showAction

How to customize a Standard Controller?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -175,22 +175,22 @@ If you still need the methods of the original ``HomepageController``, then copy
services:
sylius.controller.shop.homepage:
class: App\Controller\Shop\HomepageController
arguments: ['@twig']
autowire: true
tags: ['controller.service_arguments']

.. tip::

Run ``php bin/console debug:container sylius.controller.shop.homepage`` to check if the class has changed to your implementation.
Run ``php bin/console debug:container sylius.controller.shop.homepage`` to make sure the class has changed to your implementation.

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

.. code-block:: yaml

app_shop_custom_product:
path: /custom/product
app_shop_custom_action:
path: /custom
methods: [GET]
defaults:
_controller: sylius.controller.product:showAction
_controller: sylius.controller.shop.homepage::customAction

From now on your ``customAction`` of the ``HomepageController`` will be available alongside the ``indexAction`` from the base class.

Expand Down