2017 © Pedro Peláez
 

library zendexpr-doctrine-fixture

Zend Expressive Library that provides Doctrine Data-Fixture functionality

image

codeedu/zendexpr-doctrine-fixture

Zend Expressive Library that provides Doctrine Data-Fixture functionality

  • Saturday, July 2, 2016
  • by argentinaluiz
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,842 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Build Status, (*1)

About

This library provides integration with Zend Expressive and Doctrine Data Fixture. Also support PSR-11., (*2)

Get started

Instalation
composer require codeedu/zendexpr-doctrine-fixture:0.1.1
Registering Fixtures

To register fixtures add the fixtures in your configuration., (*3)

[
      'doctrine' => [
            'fixture' => [
                  'MyFixtures' => __DIR__ . '/../src/Fixture',
            ]
      ]
];

Register factory to create the command:, (*4)

[
      'factories' => [
         'doctrine:fixtures_cmd:load'   => \CodeEdu\FixtureFactory::class
      ]
];

We suggest to configure Doctrine ORM and commands with Zend Expressive using this gist. This configuration uses DoctrineModule. DoctrineModule provides easily configuration to integration Doctrine ORM in Zend Framework 2 Applications, so the approach is enjoy it., (*5)

Now in doctrine.config.php, so add doctrine:fixtures_cmd:load to: php $command = [ //....., 'doctrine:fixtures_cmd:load' ];, (*6)

Usage

Command Line

Access the Doctrine command line as following, (*7)

Import

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

Dependency Injection with Fixtures

This library provides inject the service container in fixtures. So add interface FixtureContainerInterface, see below:, (*8)

class MyFixture implements FixtureInterface, FixtureContainerInterface
{
    private $container;

    public function load(ObjectManager $manager){
        $myService = $this->container->get(MyService::class);
    }

    public function getContainer()
    {
        return $this->container;
    }

    public function setContainer(ContainerInterface $container)
    {
        $this->container = $container;
    }
}

The Versions

02/07 2016

dev-master

9999999-dev

Zend Expressive Library that provides Doctrine Data-Fixture functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luiz

doctrine expressive fixture zend-expressive

09/06 2016

0.0.1

0.0.1.0

Zend Expressive Library that provides Doctrine Data-Fixture functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luiz

doctrine expressive fixture zend-expressive