Doctrinebundle: BC break at 2.1.1

Created on 25 Aug 2020  路  4Comments  路  Source: doctrine/DoctrineBundle

At version 2.1.1 i got this

!!  
!!  In DefinitionErrorExceptionPass.php line 54:
!!                                                                                 
!!    Cannot autowire service "App\Repository\UserRepository": argument "$regi  
!!    stry" of method "__construct()" references interface "Doctrine\Common\Persi  
!!    stence\ManagerRegistry" but no such service exists. Did you create a class   
!!    that implements this interface?                                              
!!              

Restoring at 2.1.0 and all works fine

Most helpful comment

You can totally rename use Doctrine\Common\Persistence\ManagerRegistry to use Doctrine\Persistence\ManagerRegistry in project and all will work fine

All 4 comments

I guess we need to restore this service alias?

https://github.com/doctrine/DoctrineBundle/compare/2.1.0..2.1.1#diff-526de6d56db54965998fa70108bbe787L70

The main problem that there was removed that alias and old usages (who already use this class) was broken.
In current version ServiceEntityRepository uses Doctrine\Persistence\ManagerRegistry that does not have alias to Doctrine\Common\Persistence\ManagerRegistry. In new automatically generated repositories there are correct classes

You can totally rename use Doctrine\Common\Persistence\ManagerRegistry to use Doctrine\Persistence\ManagerRegistry in project and all will work fine

Release 2.1.2 fixes this BC break.

Was this page helpful?
0 / 5 - 0 ratings