Skip to content

Conversation

@luigimassa
Copy link
Contributor

@luigimassa luigimassa commented Oct 23, 2025

Questions Answers
Branch? 9.x
Description? Module AdminControllers for back office documentation has to be adjusted for PS9
Fixed ticket? Fixes #2057 if there is a related issue
Sponsor company Your company or customer's name goes here (if applicable).

@github-actions github-actions bot added the 9.x label Oct 23, 2025
Comment on lines +146 to +148
autoconfigure: true
tags:
- { name: controller.service_arguments }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these ones are doublons, you can either use the tag alon Or the autoconfigure alone but both are doing almost the same thing

So I would favor relying on autoconfigure: true and removing the tag part to keep the definition as simple as possible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, regarding the autowiring, maybe we should add an example when you want to inject a service manually But we're entering more in Symfony many possibilities for DI, so instead of redocumenting Symfony we should probably add a notice about the pre-requisite knowledge from the framework itself

The same links that were added in the 9.0 changes pages:

and maybe https://symfony.com/doc/6.4/controller.html for a more generic view on what a Symfony controller can do

}
```
One of the two service configuration options above is **essential and required** for your controller to work properly. Without this configuration:
- **The controller will not function** and will throw errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **The controller will not function** and will throw errors
- **The controller will not work** and will throw errors

I'm not sure which one is more correct in english, maybe I'm biased with my french point of view 😅

**Understanding the configuration:**
- `autowire: true` - Automatically injects services in constructors and method parameters
- `autoconfigure: true` - Automatically configures the controller as a service and enables all controller features
- `controller.service_arguments` tag - Required if your controller doesn't extend `AbstractController` to enable method parameter injection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true! But should we mention this? And by that I mean should we encourage people having controller that do not extend AbstractController, so not PrestaShopAdminController in the end

Or should we simply document: Use this class PrestaShopAdminController and that's enough documentation because any other type of controllers means you know what you're doing with the Symfony framework, so you are on your own because it's your specific need and your expertise

Comment on lines +313 to +316
- `$this->getConfiguration()` - Access configuration service
- `$this->getTranslator()` - Access translator service
- `$this->getRouter()` - Access router service
- `$this->getFlashBag()` - Access flash messages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a doublon with the paragraph above that lists even more thelper methods?

See the [full list of helper methods](https://github.com/PrestaShop/PrestaShop/blob/9.0.0/src/PrestaShopBundle/Controller/Admin/PrestaShopAdminController.php) in the class.

{{% notice info %}}
**Learn more about Symfony controllers:**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's what I mentioned in another comment, perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module AdminControllers for back office documentation has to be adjusted for PS9

3 participants