Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 301
Nandakumar V Avatar asked Aug 02 '20 18:08

Nandakumar V


1 Answers

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.

like image 158
Nandakumar V Avatar answered Oct 23 '22 07:10

Nandakumar V