Skip to content
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
10 changes: 5 additions & 5 deletions development/architecture/modern/controller-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ title: Symfony controllers & routing
# Symfony controllers & routing

{{% notice tip %}}
Read the Symfony documentation on [Controllers](https://symfony.com/doc/4.4/controller.html) and [Routing](https://symfony.com/doc/4.4/routing.html).
Read the Symfony documentation on [Controllers](https://symfony.com/doc/6.4/controller.html) and [Routing](https://symfony.com/doc/6.4/routing.html).
{{% /notice %}}

Controllers are located in `src/PrestaShopBundle/Controller/Admin` folder. They are organized in sub-folders following the Back Office menu. For instance, the [TaxController](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Improve/International/TaxController.php) is located in `src/PrestaShop/Controller/Admin/Improve/International`.
Controllers are located in `src/PrestaShopBundle/Controller/Admin` folder. They are organized in sub-folders following the Back Office menu. For instance, the [TaxController](https://github.com/PrestaShop/PrestaShop/blob/9.0.x/src/PrestaShopBundle/Controller/Admin/Improve/International/TaxController.php) is located in `src/PrestaShop/Controller/Admin/Improve/International`.
Same applies to **Improve**, **Sell** sections etc.

This is how the directory tree of controllers should look like:
Expand Down Expand Up @@ -40,7 +40,7 @@ Symfony Controllers should be thin by default and have only one responsibility:
* Validation
* etc...

You can take a look at [PerformanceController](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Configure/AdvancedParameters/PerformanceController.php) for an example of good implementation, and [ProductController](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/ProductController.php) for something you should avoid at all costs.
You can take a look at [PerformanceController](https://github.com/PrestaShop/PrestaShop/blob/9.0.x/src/PrestaShopBundle/Controller/Admin/Configure/AdvancedParameters/PerformanceController.php) for an example of good implementation, and [ProductController](https://github.com/PrestaShop/PrestaShop/blob/9.0.x/src/PrestaShopBundle/Controller/Admin/ProductController.php) for something you should avoid at all costs.

{{% notice warning %}}
**Never, ever call the legacy controller inside the new controller**. It's a no go, no matter the reason!
Expand Down Expand Up @@ -185,7 +185,7 @@ In this case, you can use the [Controllers helper functions](#controller-helpers

## Routing in PrestaShop

Routes are responsible for mapping a controller action to an url, you can read more about routing in [symfony docs](https://symfony.com/doc/4.4/routing.html).
Routes are responsible for mapping a controller action to an url, you can read more about routing in [symfony docs](https://symfony.com/doc/6.4/routing.html).

{{% notice info %}}
PrestaShop uses YAML files for service declaration and routing (NOT ANNOTATIONS).
Expand Down Expand Up @@ -308,4 +308,4 @@ redirected to the new migrated url.

### Javascript generation

In order to avoid hardcoded links in JavaScript, Prestashop uses the [`Router` component](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/admin-dev/themes/new-theme/js/components/router.ts).
In order to avoid hardcoded links in JavaScript, Prestashop uses the [`Router` component](https://github.com/PrestaShop/PrestaShop/blob/9.0.x/admin-dev/themes/new-theme/js/components/router.ts).