After updating to doctrine/doctrine-bundle 2.1.2
I'm getting this error:
Argument 1 passed to App\Repository\FooRepository::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in ...
My Repository looks like this:
namespace App\Repository;
use App\Entity\Foo;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
class FooRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Foo::class);
}
}
=> See my own answer below.
Just change this use
line from
use Doctrine\Common\Persistence\ManagerRegistry;
to
use Doctrine\Persistence\ManagerRegistry;
Documentation: https://symfony.com/doc/current/doctrine.html#querying-for-objects-the-repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With