Symfony 5.1.3 Issue while clearing the cache: Attempted to load class "MappingDriverChain" from namespace
Asked Answered
A

2

6

I have updated my symfony application to 5.1.3. But since then there is a class missing exception on clearing the cache.

In App_KernelDevDebugContainer.php line 1050:
                                                                               
  Attempted to load class "MappingDriverChain" from namespace "Doctrine\Common\Persistence\Mapping\Driver".                                               
  Did you forget a "use" statement for "Doctrine\Persistence\Mapping\Driver\MappingDriverChain"?    

I have checked the cache file and symfony is indeed requesting for this class on the cache. From some other SO post I got the impression that the doctrine structure have changed. I also had a similar issue on all repository class where I had to make this change

Doctrine\Persistence\ManagerRegistry => Doctrine\Common\Persistence\ManagerRegistry

I have seen a similar SO post regarding the same issue, saying updating to the latest version will solve the issue. But in my case that was not successfully.
Is it an issue with the symfony version or some other configuration issue.
And also I have created two DB connections, both are MySQL. Not sure if this have any connections to the issue.

This is my current composer.json & composer.lock

Arytenoid answered 2/8, 2020 at 18:58 Comment(2)
Have you found somerthing ? I've got the same problem.Nausea
@Nausea Can you check my answer, and see if the solution works for you?Arytenoid
A
14

I have found a solution to the issue. On composer update the doctrine/persistence is updated to V2.0.0 & doctrine/common to V3.0.2. And I think these 2 versions are not yet compatible with symfony/orm V2.0 So I had to downgrade the doctrine versions to make the application working again.

composer require doctrine/common:2.13.3 --update-with-dependencies

  - Downgrading doctrine/persistence (2.0.0 => 1.3.7): Loading from cache
  - Downgrading doctrine/common (3.0.2 => 2.13.3): Loading from cache

Now the application is in symfony 5.1.3 and working.
Will update if I come up on any issues due to this downgrade.

Arytenoid answered 3/8, 2020 at 19:10 Comment(0)
D
1

If you use doctrine-bundle I fixed it by updating it to ^2.0 = 2.5.7.

Dorina answered 25/3, 2022 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.