Upgraded DoctrineDataFixtureModule

Mon 28 Oct 2019

I've moved and upgraded my Doctrine Data Fixture Module package. Now it includes the possibility to overwrite the executor being used in the package. I've been working on a personal project where an RBAC container carries the rights and permissions on routes.

I will be working with some other people on the project soon and these fixtures will generate the permissions on routes dynamically. Being able to overwrite the executor allows me to fetch the route config with the service manager and pass that data along to the fixture itself. That was really the aim of this change on the original package.

I've also got some other specific uses for these but those are more specific to my project. I don't think that it would be hard for my fellow programmers to think of some other use cases for this.

It will really open up to a lot of possibilities that I might not even think of so that's why I put it out. Check it out for yourself on Github.

Usage

To use this, follow the normal pattern to create fixtures for Doctrine.

<?php

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

By default this package will use the ORMExecutor . Alternatively you can overwrite this with your own Executor by adding the config found in the .dist file and putting your own classes in there. The factory is totally optional of course.

<?php

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

The only thing to do is to run the command after you've setup the Executor. php ./public/index.php data-fixture:import or from the provided executable in the bin folder ./vendor/bin/doctrine-module data-fixture:import :)

Hope you make good use of this package!