I'm in the need of using fixtures for putting an initial user into my database.
I had a look at this module which is said to be pretty good: https://github.com/doctrine/data-fixtures
Unfortunately I don't understand how to use it. Alright, I build a class with my fixtures. And then? I'm used to fixtures in the way that when I create my database (
The fixtures are not available yet in the
DoctrineModule. There is a distinct module for specifically fixture loading with Doctrine and it's called the
DoctrineDataFixtureModule and can be found on GitHub.
Install it via composer:
hounddog/doctrine-data-fixture-module and enable
DoctrineDataFixtureModule in your application.config.php. If you configured doctrine already, just add this to your
'data-fixture' => array( 'location' => __DIR__ . '/../fixtures', )
And in that module's directory create a subdirectory called "fixtures". Put your classes there and run
vendor/bin/doctrine-module data-fixture:import to import the fixtures. An example of a fixture class could look like this