Symfony2, How to load fixtures with --fixtures option?

后端 未结 3 1638
后悔当初
后悔当初 2021-02-07 02:14

I need an example for command below in Symfony2 :

php app/console doctrine:mongodb:fixtures:load --fixtures=/path/to/fixture 

I don\'t know how

相关标签:
3条回答
  • 2021-02-07 02:51

    It's not require but if you want to manually specify the directory where the fixtures classes should be loaded you can use this :

    for example if I execute a command in directory symfony

    --fixtures=/src/yourBundle/fixture 
    
    0 讨论(0)
  • 2021-02-07 02:54

    I know this is old but other people have asked and these answers may not cover some of the other questions.

    You only need to specify the folder, not the file. In the above question, its not clear if FeatureFixtures is the php file or actually a folder. It may be failing if that is only a php file and not a folder. This is the correct way to load the fixtures assuming that FeatureFixtures is a php file with the fixtures:

    doctrine:fixtures:load --fixtures=src/PMI/UserBundle/DataFixtures/ORM --append
    
    0 讨论(0)
  • 2021-02-07 03:01

    You can define a fixture with the real path.

    php app/console doctrine:fixtures:load --fixtures=src/MyBundle/DataFixtures/ORM/LoadMyFixturesData.php
    
    0 讨论(0)
提交回复
热议问题