https://github.com/codeedu/zend-doctrine-fixture
Zend Framework Library that provides Doctrine Data-Fixture functionality
https://github.com/codeedu/zend-doctrine-fixture
Last synced: 10 months ago
JSON representation
Zend Framework Library that provides Doctrine Data-Fixture functionality
- Host: GitHub
- URL: https://github.com/codeedu/zend-doctrine-fixture
- Owner: codeedu
- Created: 2016-09-24T20:23:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T21:03:31.000Z (almost 7 years ago)
- Last Synced: 2025-06-18T15:52:12.463Z (12 months ago)
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About
This library provides integration with Zend Framework and Doctrine Data Fixture. Also support PSR-11.
It's based in [zendexpr-doctrine-fixture](https://github.com/codeedu/zendexpr-doctrine-fixture.git)
## Get started
##### Instalation
```sh
composer require codeedu/zend-doctrine-fixture:0.0.1
```
##### Registering Fixtures
To register fixtures add the fixtures in your configuration.
```php
[
'doctrine' => [
'fixtures' => [
'MyFixtures' => __DIR__ . '/../src/Fixture',
]
]
];
```
Register the module in modules.config.php:
```php
'CodeEdu\DoctrineFixture'
```
## Usage
#### Command Line
Access the Doctrine command line as following
#### Import
```sh
./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:
```php
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;
}
}
```