'How to override CoreShop products report correctly
I want to override CoreShop\Bundle\CoreBundle\Report\ProductsReport with my own implementation. I have created file src/AppBundle/CoreBundle/Report/ProductsReport.php with my own ProductsReport class implementation. When I'm registering it in app/config/services.yml
coreshop.report.products: '@AppBundle\CoreBundle\Report\ProductsReport'
AppBundle\CoreBundle\Report\ProductsReport:
public: true
arguments:
- '@coreshop.repository.store'
- '@doctrine.dbal.default_connection'
- '@coreshop.money_formatter'
- '@coreshop.context.locale'
- '@coreshop.repository.order'
- '@coreshop.repository.order_item'
- '@coreshop.repository.stack.product'
tags:
- { name: coreshop.report, type: products }```
And open Products report in Pimcore backend admin I see the following error 500:
coreshop-reports of type "products" already exists.
Server threw exception - could not perform action. Please reload the admin interface and try again.
Timestamp: Fri Apr 01 2022 18:08:03 GMT+0300 (Восточная Европа, летнее время)
Status: 500 | Internal Server Error
URL: /admin/coreshop/report/get-data?report=products&_dc=1648825682255
Method: GET
Message: coreshop-reports of type "products" already exists.
Trace:
in /var/www/html/vendor/coreshop/core-shop/src/CoreShop/Component/Registry/ServiceRegistry.php:60
#0 /var/www/html/var/cache/dev/Container0zy6Eci/getCoreshop_Registry_ReportsService.php(15): CoreShop\Component\Registry\ServiceRegistry->register('products', Object(CoreShop\Bundle\CoreBundle\Report\ProductsReport))
#1 /var/www/html/var/cache/dev/Container0zy6Eci/appAppKernelDevDebugContainer.php(3041): require('/var/www/html/v...')
#2 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(255): Container0zy6Eci\appAppKernelDevDebugContainer->load('getCoreshop_Reg...')
#3 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(231): Symfony\Component\DependencyInjection\Container->make('coreshop.regist...', 1)
#4 /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php(68): Symfony\Component\DependencyInjection\Container->get('coreshop.regist...')
#5 /var/www/html/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Controller/ReportsController.php(33): Symfony\Bundle\FrameworkBundle\Controller\Controller->get('coreshop.regist...')
#6 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(158): CoreShop\Bundle\CoreBundle\Controller\ReportsController->getReportDataAction(Object(Symfony\Component\HttpFoundation\Request))
#7 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#8 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(201): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#9 /var/www/html/web/app.php(36): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#10 {main}
CoreShop version is 2.2.9
Pimcore CMS version is v6.9.3
Symfony version 4.4.39
How can I register my products report implementation correctly?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
