symfony Fatal error: Declaration of App\DataFixtures\AppFixtures::load(Doctrine\Common\Persistence

报错:

 Fatal error: Declaration of App\DataFixtures\AppFixtures::load(Doctrine\Common\Persistence\ObjectManager $manager) must be compatible with Doctrine\Common\DataFixtures\FixtureInterface::load(Doctrine\Persistence\ObjectManager $manager) in E:\wamp64\www\vrPlatform\src\DataFixtures\AppFixtures.php on line 8
 

问题背景:

symfony项目 composer update 后

解决:

  1. 删除 \src\DataFixtures目录
  2. bin/console cache:clear
  3. use Doctrine\Common\Persistence\ManagerRegistry;
    改为:
    use Doctrine\Persistence\ManagerRegistry;
    
    // 参考:https://stackoverflow.com/questions/63688919/error-argument-1-passed-to-app-repository-foorepository-construct-must-be

原因:

symfony版本差异

 

 

 

posted @ 2021-04-02 17:00  我的五年  阅读(22)  评论(0)    收藏  举报  来源