PHP code example of drakulitka / doctrine-data-fixture-module

1. Go to this page and download the library: Download drakulitka/doctrine-data-fixture-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drakulitka / doctrine-data-fixture-module example snippets



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



namespace YourModuleName\Fixture;

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');        
    }
}