doctrine/DoctrineMongoDBBundle

Can't install on a brand new `symfony/website-skeleton:"5.3.x@dev"`

quentint opened this issue · 6 comments

I just locally installed a new Symfony website skeleton with composer create-project symfony/website-skeleton:"5.3.x@dev" my-dir. I then installed this bundle like suggested in the docs; with composer config extra.symfony.allow-contrib true and composer require doctrine/mongodb-odm-bundle.

Unfortunately it failed with this message:

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#5581
!!    #message: """
!!      Attempted to load class "ArrayCache" from namespace "Doctrine\Common\Cache".\n
!!      Did you forget a "use" statement for another namespace?
!!      """
!!    #code: 0
!!    #file: "./var/cache/dev/ContainerBn8LuqE/getDoctrineMongodb_Odm_DefaultDocumentManagerService.php"
!!    #line: 31
!!    trace: {
!!      ./var/cache/dev/ContainerBn8LuqE/getDoctrineMongodb_Odm_DefaultDocumentManagerService.php:31 {
!!        ContainerBn8LuqE\getDoctrineMongodb_Odm_DefaultDocumentManagerService::do($container, $lazyLoad = true)
!!        ›
!!        › $b = new \Doctrine\Common\Cache\ArrayCache();
!!        › $b->setNamespace('sf_mongodb_default_bg74IPW');
!!      }
!!      ./var/cache/dev/ContainerBn8LuqE/App_KernelDevDebugContainer.php:453 { …}
!!      ./vendor/symfony/dependency-injection/Container.php:246 { …}
!!      ./vendor/symfony/dependency-injection/Container.php:228 { …}
!!      ./vendor/symfony/doctrine-bridge/ManagerRegistry.php:38 { …}
!!      ./vendor/doctrine/persistence/lib/Doctrine/Persistence/AbstractManagerRegistry.php:205 { …}
!!      ./vendor/doctrine/mongodb-odm-bundle/CacheWarmer/ProxyCacheWarmer.php:70 { …}
!!      ./vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:98 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:584 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:786 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:125 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:168 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:74 { …}
!!      ./vendor/symfony/console/Application.php:167 { …}
!!      ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:56 { …}
!!      ./vendor/autoload_runtime.php:35 { …}
!!      ./bin/console:11 { …}
!!    }
!!  }
!!  2021-06-01T20:54:30+00:00 [critical] Uncaught Error: Class 'Doctrine\Common\Cache\ArrayCache' not found
!!
Script @auto-scripts was called via post-update-cmd

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

And indeed, Doctrine's ArrayCache doesn't seem to exist anymore.
Is there a way for me to fix this?

Thanks for your help 😉

There is same problem at Symfony 5.2x and 5.3x

Please add an explicit requirement to doctrine/cache ^1.11 to your composer.json to work around this issue. This will be fixed in the upcoming release. Sorry for the trouble.

Works, thanks @alcaeus!

This issue is still present to this day

Yes, I know, and the workarounds still work. I'm busy with other work at the moment, hence no release with a fix. Don't install dev versions if you don't want trouble.

For the workaround I suggest to use conflict instead, that way it will be "more obvious" that it's not a requirement for the project.