diegograssato / doctrine-data-fixture-module
Zend Framework 2 Module that provides Doctrine Data-Fixture functionality
Requires
- php: ^5.6 || ^7.0
- doctrine/data-fixtures: ^1.2
- doctrine/doctrine-module: ^1.2
- doctrine/doctrine-orm-module: ^1.1
- zendframework/zend-servicemanager: ^2.7.6 || ^3.1
- zendframework/zend-stdlib: ^2.7.7 || ^3.0.1
Requires (Dev)
- phpunit/phpunit: ^3.7
- satooshi/php-coveralls: ^0.6
- squizlabs/php_codesniffer: ^1.4
This package is auto-updated.
Last update: 2024-11-28 16:10:52 UTC
README
Introduction
The DoctrineDataFixtureModule module intends to integrate Doctrine 2 data-fixture with Zend Framework 3 quickly and easily. The following features are intended to work out of the box:
- Doctrine ORM support
- Multiple ORM entity managers
- Multiple DBAL connections
- Support reuse existing PDO connections in DBAL
Requirements
This module is designed to work with a typical ZF2 MVC application.
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
$ php composer.phar require --dev "diegograssato/doctrine-odm-datafixture": "2.0"
Then open config/development.config.php
and DoctrineDataFixtureModule
to your modules
Registering Fixtures
To register fixtures with Doctrine module add the fixtures in your configuration.
'orm_fixtures' => [ __DIR__.'/../MyModule/src/MyModule/Fixtures', ]
or group configurator
'orm_fixtures' => [ 'groups' => [ 'default' => [ __DIR__.'/../MyModule/src/MyModule/Fixtures/default', ], 'production' => [ __DIR__.'/../MyModule/src/MyModule/Fixtures/production', ] ] ]
To rotate the fixture use the terminal command:
vendor/bin/doctrine-odm-datafixture odm:fixtures:load
The odm:fixture:load command loads data fixtures from your bundles:
vendor/bin/doctrine-module orm:fixtures:load
You can also optionally specify the path to fixtures with the --fixtures option:
vendor/bin/doctrine-module orm:fixtures:load --fixture=/path/to/fixtures1 --fixture=/path/to/fixtures2
If you want to append the fixtures instead of flushing the database first you can use the --append option:
vendor/bin/doctrine-module orm:fixtures:load --fixture=/path/to/fixtures1 --fixture=/path/to/fixtures2 --append
You can also optionally specify the group configuration:
vendor/bin/doctrine-module orm:fixtures:load --group production
You can also optionally list the fixtures:
vendor/bin/doctrine-module orm:fixtures:list --group production