Gardel Posted April 24, 2020 Share Posted April 24, 2020 Hello there, I'm writing a module that needs to override the ProductVirtual class (src/PrestaShopBundle/Form/Admin/Product/ProductVirtual.php). As it is apparently a Symfony service, I'm trying to override it as instructed in the documentation. To do that, I copied the original ProductVirtual.php file to modules/mymodule/ProductVirtual.php and replaced the namespace by MyModule and created the file modules/mymodule/config/services.yml with the following content: services: form.type.product.virtual: class: MyModule\ProductVirtual arguments: - "@translator" - "@prestashop.adapter.legacy.context" parent: 'form.type.common_type' public: true tags: - { name: form.type } However, what I get is a 500 error and the following exception: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Too few arguments to function PrestaShopBundle\Form\Admin\Product\ProductVirtual::__construct(), 0 passed in /bitnami/prestashop/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php on line 92 and exactly 2 expected" at /bitnami/prestashop/src/PrestaShopBundle/Form/Admin/Product/ProductVirtual.php line 52 Of course, 2 arguments are expected by the ProductVirtual's constructor but this FormRegistry.getType() method calls the constructor with no argument. I can't find a way to correct the problem and I have no knowledge in Symfony. I really need some advice here. Thanks! Link to comment Share on other sites More sharing options...
Gardel Posted May 5, 2020 Author Share Posted May 5, 2020 Hi, I'm upping this topic as I still haven't found a solution! 1 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