Skip to content
Fork of Hounddogs original ZF2 code ported to ZF3.
PHP
Branch: master
Clone or download
Pull request Compare This branch is 4 commits ahead of rvdlee-salesupply:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src/DoctrineDataFixtureModule
tests
.gitignore
.travis.yml
LICENSE
Module.php
README.md
clover.xml
composer.json
composer.lock
coveralls-upload.json
phpunit.xml

README.md

DoctrineDataFixture Module for Zend Framework 3

Latest Version on Packagist Scrutinizer Code Quality Total Downloads GitHub license Donate

Introduction

This is a port for ZF3 of Hounddog's orignal code to make fixtures supported in the form of a CLI command.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

$ composer require rvdlee/doctrine-data-fixture-module

Then open config/application.config.php and add DoctrineModule, DoctrineORMModule and DoctrineDataFixtureModule to your modules

Registering Fixtures

To register fixtures with Doctrine module add the fixtures in your configuration.

<?php

return [
    'doctrine' => [
        'fixture' => [
            __NAMESPACE__ . '_fixture' => __DIR__ . '/../src/' . __NAMESPACE__ . '/Fixture',
        ]
    ]
];

Alternativly you can overwrite the executor that fires off the fixtures. I've made an dist file you can follow to make your own. Executors fall in the service category if you need to make a factory for one.

<?php

return [
    'rvdlee' => [
        'doctrine-data-fixture' => [
            'executor' => YourExecutor::class,
        ],
    ],
    'service_manager' => [
        'factories' => [
            YourExecutor::class => YourExecutorFactory::class,
        ],
    ],
];

Usage

Command Line

Access the Doctrine command line as following from your project root:

$ ./vendor/bin/doctrine-module data-fixture:import 

Why use a custom Executor?

I've made fixtures based on entity meta-data or route config for example. A custom executor can provide such information and pass it along to your fixtures.

You can’t perform that action at this time.