sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Error with tying download data from list. "sonata.admin.exporter.do-not-use" - not-existent service #7361

Closed AndrewSpin closed 3 years ago

AndrewSpin commented 3 years ago

Environment

Sonata packages

show

``` sonata-project/admin-bundle 3.104.0 3.104.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.5.3 4.6.0 Symfony SonataBlockBundle sonata-project/cache 2.0.1 2.2.0 Cache library sonata-project/doctrine-extensions 1.12.0 1.13.1 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 3.33.0 3.35.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.6.2 2.7.0 Lightweight Exporter library sonata-project/form-extensions 1.9.0 1.9.0 Symfony form extensions sonata-project/twig-extensions 1.5.1 1.7.0 Sonata twig extensions ```

PHP version

PHP 7.4.22 (cli) (built: Jul 30 2021 01:30:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.22, Copyright (c), by Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans

Subject

Error with tying download data from list. Action export. Now its return error message "You have requested a non-existent service "sonata.admin.exporter.do-not-use". Did you mean this: "sonata.admin.pool.do-not-use"?"

As I see, problem located at vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php:970 $exporter = $this->get('sonata.admin.exporter.do-not-use');

Steps to reproduce

Expected results

The datagrid must be downloaded to the file

Actual results

Exception:"You have requested a non-existent service "sonata.admin.exporter.do-not-use". Did you mean this: "sonata.admin.pool.do-not-use"?"

Stack Trace: at vendor/symfony/dependency-injection/Container.php:289 at Symfony\Component\DependencyInjection\Container->make('sonata.admin.exporter.do-not-use', 1) (vendor/symfony/dependency-injection/Container.php:231) at Symfony\Component\DependencyInjection\Container->get('sonata.admin.exporter.do-not-use') (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:68) at Sonata\AdminBundle\Controller\CRUDController->get('sonata.admin.exporter.do-not-use') (vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php:957) at Sonata\AdminBundle\Controller\CRUDController->exportAction(object(Request)) (vendor/symfony/http-kernel/HttpKernel.php:158) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:80) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:25)

VincentLanglet commented 3 years ago

A PR should be done to change to sonata.admin.exporter, can you do it @AndrewSpin ?

Also, if you're inside this if, you should get the following deprecation

'Not registering the exporter bundle is deprecated since version 3.14. You must register it to be able to use the export action in 4.0.',

So registering the ExporterBundle fix the issue.

VincentLanglet commented 3 years ago

I did https://github.com/sonata-project/SonataAdminBundle/pull/7363

AndrewSpin commented 3 years ago

@VincentLanglet Thanks for fix. I updated to 3.105.0 and it works ok now