문제

While running the php "app/console faker:populate" I am getting following error:

 [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

In my config.yml i have:

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
도움이 되었습니까?

해결책

EntityManagerInterface was added in Doctrine 2.4 and the master branch of Faker is already depending on it. So, either upgrade Doctrine to 2.4 or downgrade Faker from master to 1.2.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top