Symfony2,如何使用 --fixtures 选项加载装置? [英] Symfony2, How to load fixtures with --fixtures option?
问题描述
我需要以下 Symfony2 中的命令示例:
I need an example for command below in Symfony2 :
php app/console doctrine:mongodb:fixtures:load --fixtures=/path/to/fixture
我不知道如何设置--fixtures=/path/to/fixture
.我可以一起加载,但我不能只加载一个新装置!
I don't know how to set the --fixtures=/path/to/fixture
. I can load all together but I cannot do it for only one new fixture !
/path/to/fixture 应该是什么格式?
What format should /path/to/fixture be ?
我也试过这个 --fixtures=src/PMI/UserBundle/DataFixtures/ORM/FeatureFixtures
但我每次都得到这个:
Also I tried this --fixtures=src/PMI/UserBundle/DataFixtures/ORM/FeatureFixtures
but I get this every time :
[InvalidArgumentException]
Could not find any fixtures to load in:
- src/PMI/UserBundle/DataFixtures/ORM/FeatureFixtures
推荐答案
我知道这是旧的,但其他人已经问过,这些答案可能没有涵盖其他一些问题.
I know this is old but other people have asked and these answers may not cover some of the other questions.
您只需要指定文件夹,而不是文件.在上面的问题中,不清楚 FeatureFixtures 是 php 文件还是实际上是一个文件夹.如果这只是一个 php 文件而不是一个文件夹,它可能会失败.这是加载装置的正确方法,假设 FeatureFixtures 是一个带有装置的 php 文件:
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
这篇关于Symfony2,如何使用 --fixtures 选项加载装置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!