This is fork from Houndog/DoctrineDataFixtureModule.
The DoctrineDataFixtureModule module intends to integrate Doctrine2 ORM Data Fixtures with Zend Framework 3.
Add this project in your repositories in composer.json:
"repositories": [
{
"type": "git",
"url": "https://github.com/revenkroz/laminas-doctrine-fixture-module"
}
]
Install package:
composer req revenkroz/laminas-doctrine-fixture-module:dev-main
Add DoctrineFixtureModule
to your modules
.
To register fixtures with Doctrine module add the fixtures in your configuration.
<?php
return [
'doctrine' => [
'fixture' => [
'ModuleName' => __DIR__ . '/../src/ModuleName/Fixture',
],
],
];
./vendor/bin/doctrine-module orm:fixtures:load
./vendor/bin/doctrine-module orm:fixtures:load -n --purge-with-truncate
./vendor/bin/doctrine-module orm:fixtures:load -n --append
<?php
namespace Application\DataFixtures;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use DoctrineDataFixtureModule\ContainerAwareInterface;
use DoctrineDataFixtureModule\ContainerAwareTrait;
class LoadUser implements FixtureInterface, ContainerAwareInterface
{
use ContainerAwareTrait;
/**
* @param ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$myService = $this->container->get('my_service');
}
}