无法加载 Symfony\Bridge\Doctrine\RegistryInterface
cannot load the Symfony\Bridge\Doctrine\RegistryInterface
我想在一台新电脑上使用我的应用程序,所以我从 Git 中提取所有内容并重新启动 composer
和 yarn
以获取我所有的第三方包和库。
当 运行 composer update
我得到以下错误:
Cannot autowire service "App\Repository\BlogPostRepository": argument "$registry" of method "__construct()" references interface "Symfony\Bridge\Doctrine\RegistryInterface" but no such service exists. Try changing the type-hint to "Doctrine\Common\Persistence\ManagerRegistry" instead.
我的`BlogRepository
namespace App\Repository;
use App\Entity\BlogPost;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @method BlogPost|null find($id, $lockMode = null, $lockVersion = null)
* @method BlogPost|null findOneBy(array $criteria, array $orderBy = null)
* @method BlogPost[] findAll()
* @method BlogPost[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class BlogPostRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, BlogPost::class);
}
}
它是由 symfony 自动生成的,我从未更改过它。是错误还是 composer-update
改变了一切?
自 8 月起已弃用,如此 issue 我的坏处
根据 error
中的建议,我们现在需要使用父接口:
use Doctrine\Common\Persistence\ManagerRegistry;
我想在一台新电脑上使用我的应用程序,所以我从 Git 中提取所有内容并重新启动 composer
和 yarn
以获取我所有的第三方包和库。
当 运行 composer update
我得到以下错误:
Cannot autowire service "App\Repository\BlogPostRepository": argument "$registry" of method "__construct()" references interface "Symfony\Bridge\Doctrine\RegistryInterface" but no such service exists. Try changing the type-hint to "Doctrine\Common\Persistence\ManagerRegistry" instead.
我的`BlogRepository
namespace App\Repository;
use App\Entity\BlogPost;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @method BlogPost|null find($id, $lockMode = null, $lockVersion = null)
* @method BlogPost|null findOneBy(array $criteria, array $orderBy = null)
* @method BlogPost[] findAll()
* @method BlogPost[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class BlogPostRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, BlogPost::class);
}
}
它是由 symfony 自动生成的,我从未更改过它。是错误还是 composer-update
改变了一切?
自 8 月起已弃用,如此 issue 我的坏处
根据 error
中的建议,我们现在需要使用父接口:
use Doctrine\Common\Persistence\ManagerRegistry;