it-blaster/fixtures-bundle

Propel fixtures 的 Symfony2 扩展包

安装: 176

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 6

分支: 0

公开问题: 0

类型:symfony-bundle

v1.0.0 2015-03-24 17:24 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:39:52 UTC


README

Build Status Scrutinizer Code Quality

Symfony2 扩展包用于 Propel fixtures。由于普通的 propel:fixtures:load 任务会抛出错误 Attempted to call method "getPeerClassname" on class "Propel\Runtime\Map\TableMap".,为了修复这个问题,需要重写任务和 DataFixtures/Loader 文件夹中的文件。所有这些都被放到了一个独立的包 FixturesBundle 中。

安装

ItBlasterFixturesBundle 添加到 composer.json

{
    "require": {
        "it-blaster/fixtures-bundle": "dev-master"
	},
}

现在运行 composer 命令下载包

$ php composer.phar update it-blaster/fixtures-bundle

composer 会将包安装到项目文件夹 vendor/it-blaster/fixtures-bundle 中。

接下来在 AppKernel.php 核心中连接包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new ItBlaster\FixturesBundle\ItBlasterFixturesBundle(),
    );
}

导出 - 创建 fixtures

创建 fixtures 的任务可以通过命令 php app/console it-blaster:fixtures:dump 执行。fixtures 文件将被创建在 app/propel/fixtures 中。

加载 - 从 fixtures 加载到数据库

加载 fixtures 的任务可以通过命令 php app/console it-blaster:fixtures:load @AppMainBundle 执行,其中 @AppMainBundle 是包含 fixtures 文件的包名。默认情况下,fixtures 文件将从 app/propel/fixtures 文件夹中获取。

鸣谢

It-Blaster it-blaster@yandex.ru