DoctrineBundle: Upgrading to doctrine/orm 2.7.3 with doctrine/common 3.0 causes Class not found errors

After issuing a composer update on doctrine/* on a newly upgrade Symfony 5 project, during the cache warmup I’m getting the below error when using doctrine/common 3.0

Fatal error: Uncaught Error: Class 'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain' not found in /my-project/app/var/cache/dev/ContainerPxbhKBF/App_KernelDevDebugContainer.php on line 1420

Error: Class 'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain' not found in /my-project/app/var/cache/dev/ContainerPxbhKBF/App_KernelDevDebugContainer.php on line 1420

Call Stack:
    0.0013     404360   1. {main}() /my-project/app/bin/console:0
    0.0431    2139208   2. Symfony\Bundle\FrameworkBundle\Console\Application->run() /my-project/app/bin/console:38
    0.0831    2309936   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /my-project/app/vendor/symfony/console/Application.php:140
    0.0831    2309936   4. Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() /my-project/app/vendor/symfony/framework-bundle/Console/Application.php:74
    0.0831    2309936   5. App\Kernel->boot() /my-project/app/vendor/symfony/framework-bundle/Console/Application.php:168
    0.1086    3312160   6. App\Kernel->initializeContainer() /my-project/app/vendor/symfony/http-kernel/Kernel.php:131
    9.1711   59944952   7. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() /my-project/app/vendor/symfony/http-kernel/Kernel.php:572
    9.1748   60014128   8. ContainerPxbhKBF\getCacheWarmerService::ContainerPxbhKBF\{closure:/my-project/app/var/cache/dev/ContainerPxbhKBF/getCacheWarmerService.php:23-33}() /my-project/app/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:90
    9.1748   60014128   9. ContainerPxbhKBF\App_KernelDevDebugContainer->load() /my-project/app/var/cache/dev/ContainerPxbhKBF/getCacheWarmerService.php:25
    9.1751   60031800  10. ContainerPxbhKBF\getValidator_Mapping_CacheWarmerService::do() /my-project/app/var/cache/dev/ContainerPxbhKBF/App_KernelDevDebugContainer.php:840
    9.1752   60031880  11. ContainerPxbhKBF\App_KernelDevDebugContainer->getValidator_BuilderService() /my-project/app/var/cache/dev/ContainerPxbhKBF/getValidator_Mapping_CacheWarmerService.php:24
    9.1812   60396792  12. ContainerPxbhKBF\App_KernelDevDebugContainer->getDoctrine_Orm_DefaultEntityManagerService() /my-project/app/var/cache/dev/ContainerPxbhKBF/App_KernelDevDebugContainer.php:2892

If I force doctrine/common to ^2.7 <3.0, the errors go away. Maybe doctrine/orm:2.x shouldn’t be doctrine/common:^2.11 || ^3.0 just yet?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Off-topic: Thank you both (greg0ire/trickeyone) for showing this kind of fair-play and for calming a heated arguments’ thread - it’s so uncommon and nice, that it ~blew my mind! (it shouldn’t have, because this kind of behavior should be the norm, but unfortunately, it isn’t - either on Github or Reddit or HN or wherever…)

Sorry, meant to add this yesterday. I was able to successfully upgrade doctrine/doctrine-bundle to 2.1.2 and doctrine/persistence to 2.0.0. Thanks once again for all the help, @greg0ire !!

Looks good. My projects don’t explicitly require doctrine/persistence, so I’m assuming there shouldn’t be any issue with the change from ^1.3.3 to ^1.3.3 | 2.0. I’ll keep any eye out for a new release for doctrine/doctrine-bundle to verify.

Thank you very much for the assistance, @greg0ire.

$ composer why-not doctrine/doctrine-bundle 2.1.0 
doctrine/doctrine-bundle  2.1.0        requires          doctrine/persistence (^1.3.3)                  
my/app                    master  does not require  doctrine/persistence (but 2.0.0 is installed)