feeltr / fixture-loader-bundle
Doctrine fixtures loader during database migrations
Installs: 142
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.9
- doctrine/data-fixtures: ~1.0
- doctrine/migrations: ~1.0
- doctrine/orm: ~2.3
- symfony/console: ~2.2|~3.0.0
- symfony/dependency-injection: ~2.2|~3.0.0
- symfony/doctrine-bridge: ~2.2|~3.0.0
Requires (Dev)
- php: >=5.5.0
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2018-04-28 12:32:32 UTC
README
This bundle allows you to execute Doctrine fixtures during database migrations
Installation
First install the package using composer
$ composer require feeltr/fixture-loader-bundle
After installing the package, add the bundle in app/AppKernel.php
// AppKernel::registerBundles() $bundles = array( // ... new Feeltr\Bundle\FixtureLoaderBundle\FixtureLoaderBundle(), // ... );
Usage
Extend from FixtureLoaderMigration
to have access to the fixture loader during migrations:
<?php namespace Application\Migrations; use Feeltr\Bundle\FixtureLoaderBundle\Component\FixtureLoaderMigration; class Version20150809022933 extends FixtureLoaderMigration { /** * @param Schema $schema */ public function up(Schema $schema) { // ... } /** * @param Schema $schema */ public function down(Schema $schema) { // ... } /** * @param Schema $schema */ public function postUp(Schema $schema) { $this->loadFixtures([ new Fixture(), ... ]); } }
Additionally, you can use the fixture loader defined in the service container:
$fixtureLoader = $this->container->get('feeltr_fixture_loader'); $fixtureLoader->load([new Fixture()]);
Finally, you can disable logging using symfony bundle configuration in app/config/config.yml
. By default, logging is enabled.
feeltr_fixture_loader: logging: false