Skip to content

Commit

Permalink
bug #11019 [Documentation] Add hint about disabling autowire when ext…
Browse files Browse the repository at this point in the history
…ending a controller (adrianmarte)

This PR was merged into the 1.5 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.5
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | replaces #10706
| License         | MIT

Commits
-------

390b073 Improve docs for extending a controller
b946dc9 Fix code block
  • Loading branch information
lchrusciel authored Jan 15, 2020
2 parents 6d2e04e + b946dc9 commit ac0f2ff
Showing 1 changed file with 11 additions and 10 deletions.
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

0 comments on commit ac0f2ff

Please sign in to comment.