From f1028ab0d4c73606373d4372502af1d680e004e5 Mon Sep 17 00:00:00 2001 From: Stephane DECOCK Date: Fri, 12 Feb 2021 08:23:53 +0100 Subject: [PATCH 1/2] Updating the controller customization doc * Fix the last route declaration to its real use * Use the term `make sure` instead of `check if` since it is should to work * use the double `:` syntax for controllers instead of the deprecated single `:` --- docs/customization/controller.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/customization/controller.rst b/docs/customization/controller.rst index c8df2563711..f7bd024a377 100644 --- a/docs/customization/controller.rst +++ b/docs/customization/controller.rst @@ -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``. @@ -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? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -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/action 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. From 4f6b2de629da9927735b7789a1858adc266b6e65 Mon Sep 17 00:00:00 2001 From: Stephane DECOCK Date: Fri, 12 Feb 2021 10:30:44 +0100 Subject: [PATCH 2/2] Update docs/customization/controller.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change custom route Co-authored-by: Łukasz Chruściel --- docs/customization/controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/customization/controller.rst b/docs/customization/controller.rst index f7bd024a377..4af4bf1dbd0 100644 --- a/docs/customization/controller.rst +++ b/docs/customization/controller.rst @@ -187,7 +187,7 @@ If you still need the methods of the original ``HomepageController``, then copy .. code-block:: yaml app_shop_custom_action: - path: /custom/action + path: /custom methods: [GET] defaults: _controller: sylius.controller.shop.homepage::customAction