GwenaelleH Posted March 28 Share Posted March 28 (edited) Hello everyone, I am currently working with Prestashop 8.1.4. I've read the documentation on how to decorate a core controller https://devdocs.prestashop-project.org/8/modules/concepts/controllers/admin-controllers/override-decorate-controller/#decorate-the-controller but the controller I try to decorate (ProductController) do not match the example (and I can't make it work). I take another exemple with decoration of PrestaShopBundle\Controller\Admin\Sell\Catalog\SupplierController which works fine. But PrestaShopBundle\Controller\Admin\Sell\Catalog\Product\ProductController got a construct function which I can't find how to deal with in my decorating controller which need his own constructor. /** * @param ProductRepository $productRepository */ public function __construct(ProductRepository $productRepository) { $this->productRepository = $productRepository; } Here is the error raised when trying to access the website or launching any console command : You have requested a non-existent service "PrestaShopBundle\Controller\Admin\Sell\Catalog\Product\ProductController". MyModule/config/services.yml : services: Company\MyModule\Controller\Admin\DecoProductController: autowire: true decorates: PrestaShopBundle\Controller\Admin\Sell\Catalog\Product\ProductController Company\MyModule\Controller\Admin\DecoSupplierController: autowire: true decorates: PrestaShopBundle\Controller\Admin\Sell\Catalog\SupplierController Let me know if you need more details, if I have to attach the files I am working on ? Tanks a lot. Best regards. Edited March 28 by GwenaelleH (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now