knplabs/rad-fixtures-load

此包已被废弃,不再维护。没有建议的替代包。

加载所有包的命令

1.6.1 2017-09-21 08:22 UTC

README

不幸的是,我们决定不再维护此项目 anymore (查看原因)。如果您想将另一个包标记为替代包,请发送电子邮件至 hello@knplabs.com

快速应用开发:Fixtures Load

加载所有包的命令

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

此库使用了优秀的 nelmio/alice 库。

官方维护者

安装

composer require --dev knplabs/rad-fixtures-load:~1.0
class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\Rad\FixturesLoad\Bundle\FixturesLoadBundle(),
            //...
        );

        //...

        return $bundles;
    }
}

用法

在您的bundle中,您需要将Alice fixtures文件存储到Resources/fixtures/orm

加载所有bundle的Fixtures

只需运行以下命令

app/console rad:fixtures:load

如果您需要重置模式,请添加-r选项

app/console rad:fixtures:load -r

加载特定bundle的Fixtures

我有两个bundle,AppApi

app/console rad:fixtures:load -b App -b Api

顺序很重要。将按照此顺序加载Fixtures。

使用文件过滤

如果运行此命令

app/console rad:fixtures:load -f dev

所有以.dev.yml结尾的文件都将被加载。只加载这些文件。

您也可以链式过滤。

app/console rad:fixtures:load -f dev -f test

在这种情况下,顺序没有关系。

使用Alice提供者或Alice处理器

您只需将服务标记为knp_rad_fixtures_load.providerknp_rad_fixtures_load.processor

my_bundle.my_provider:
    class: My\Provider
    tags:
        - { name: knp_rad_fixtures_load.provider }

my_bundle.my_processor:
    class: My\Processor # implements Nelmio\Alice\ProcessorInterface
    tags:
        - { name: knp_rad_fixtures_load.processor }