sonata-project / SonataDoctrineMongoDBAdminBundle

Symfony Sonata / Integrate Doctrine MongoDB ODM into the SonataAdminBundle
https://docs.sonata-project.org/projects/SonataDoctrineMongoDBAdminBundle
MIT License
65 stars 95 forks source link

SourceIteratorInterface on final class DataSource not exist on install #770

Closed antonintouron closed 2 years ago

antonintouron commented 2 years ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' - patch or minor release available - update recommended - major release available - update possible - up to date version sonata-project/admin-bundle 4.16.0 4.16.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.16.0 4.16.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 2.0.0 2.0.0 Doctrine2 behavioral extensions sonata-project/doctrine-mongodb-admin-bundle 4.3.3 4.3.3 Symfony Sonata / Integrate Doctrine MongoDB ODM into the SonataAdminBundle sonata-project/exporter 3.0.0 3.0.0 Lightweight Exporter library sonata-project/form-extensions 1.18.0 1.18.0 Symfony form extensions sonata-project/twig-extensions 2.0.0 2.0.0 Sonata twig extensions ```

PHP version

$ php -v
8.1

Subject

When your install bundle with composer require sonata-project/doctrine-mongodb-admin-bundle you have an PHP fatal error :

Fatal error: During inheritance of Sonata\DoctrineMongoDBAdminBundle\Exporter\DataSource, while autoloading Sonata\Exporter\Source\SourceIteratorInterface: Uncaught ReflectionException: Cl ass "Sonata\Exporter\Source\SourceIteratorInterface" not found while loading "Sonata\DoctrineMongoDBAdminBundle\Exporter\DataSource". in /var/www/html/vendor/symfony/error-handler/DebugClassLo ader.php:285

Minimal repository with the bug

Steps to reproduce

Expected results

This error on sonataDoctrineMongoDBAdminBundle installation :

Fatal error: During inheritance of Sonata\DoctrineMongoDBAdminBundle\Exporter\DataSource, while autoloading Sonata\Exporter\Source\SourceIteratorInterface: Uncaught ReflectionException: Cl ass "Sonata\Exporter\Source\SourceIteratorInterface" not found while loading "Sonata\DoctrineMongoDBAdminBundle\Exporter\DataSource". in /var/www/html/vendor/symfony/error-handler/DebugClassLo ader.php:285

Solution

  1. Go to vendor/sonata-project/doctrine-mongodb-admin-bundle/src/Exporter/DataSource.php
  2. Interface SourceIteratorInterface used on return function of createIterator not exist, replace by DoctrineODMQuerySourceIterator work, but it's fine ?
VincentLanglet commented 2 years ago

The issue is that sonata-project/exporter": "^2.0 was not in the dependencies so you're installing 3.0 in which the class was removed.

I'll do a fix. But you can require sonata-project/exporter": "^2.0" to fix your issue temporary.

antonintouron commented 2 years ago

thanks it's work with exporter 2.11 !