【问题标题】:Symfony2 Faker Populate ContextErrorExceptionSymfony2 Faker 填充 ContextErrorException
【发布时间】:2013-09-19 14:08:07
【问题描述】:

运行 php "app/console faker:populate" 时出现以下错误:

 [Symfony\Component\Debug\Exception\ContextErrorException]                    
  Catchable Fatal Error: Argument 1 passed to Faker\ORM\Doctrine\EntityPopula  
  tor::execute() must be an instance of Doctrine\ORM\EntityManagerInterface,   
  instance of Doctrine\ORM\EntityManager given, called in /Users/hardeep/Docu  
  ments/Workspace/PHP/Websites/test.example.com/Symfony/vendor/fzaninotto/fake  
  r/src/Faker/ORM/Doctrine/Populator.php on line 71 and defined in /Users/har  
  deep/Documents/Workspace/PHP/Websites/test.example.com/Symfony/vendor/fzanin  
  otto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php line 131

在我的 config.yml 我有:

bazinga_faker:
    orm: doctrine
    entities:
        Example\RestApiBundle\Entity\Album:
            number: 10
        Example\RestApiBundle\Entity\Track:
            number: 10
        Example\RestApiBundle\Entity\Artist:
            number: 10
        Example\RestApiBundle\Entity\Language:
            number: 10
        Example\RestApiBundle\Entity\Playlist:
            number: 10
        Example\RestApiBundle\Entity\User:
            number: 10

【问题讨论】:

    标签: php symfony faker


    【解决方案1】:

    EntityManagerInterface 是在 Doctrine 2.4 中添加的,Faker 的 master 分支已经依赖于它。因此,要么将 Doctrine 升级到 2.4,要么将 Faker 从 master 降级到 1.2。

    【讨论】:

      猜你喜欢
      • 2014-09-08
      • 2016-03-31
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2020-11-16
      • 2013-11-27
      • 1970-01-01
      • 2021-06-30
      相关资源
      最近更新 更多