it-blaster/fixtures-bundle

Symfony2 bundle for propel fixtures

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

This package is not auto-updated.

Last update: 2024-04-13 14:39:53 UTC


README

Build Status Scrutinizer Code Quality

Symfony2 bundle for propel fixtures. Т.к. обычный таск propel:fixtures:load выдаёт ошибку Attempted to call method "getPeerClassname" on class "Propel\Runtime\Map\TableMap"., чтобы его поправить пришлось переопределить таск и файлы папки DataFixtures/Loader. Всё это вынесено в отдельный бандл FixturesBundle.

Installation

Добавьте ItBlasterFixturesBundle в composer.json:

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

Теперь запустите композер, чтобы скачать бандл командой:

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

Композер установит бандл в папку проекта vendor/it-blaster/fixtures-bundle.

Далее подключите бандл в ядре AppKernel.php:

<?php
// app/AppKernel.php

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

Dump - Создание фикстур

Таск создания fixtures запускается командой php app/console it-blaster:fixtures:dump. Файл с фикстурами будет создан в app/propel/fixtures.

Load - Загрузка из фикстур в базу

Таск загрузки fixtures запускается командой php app/console it-blaster:fixtures:load @AppMainBundle, где @AppMainBundle имя бандла, где у вас лежат файлы-fixtures. По умолчанию файлы-fixtures будут браться из папки app/propel/fixtures.

Credits

It-Blaster it-blaster@yandex.ru