The project is no longer supported. If you still want to create fixtures with yaml, then I recommend switching to Alice.
Add DavidBaduraFixtureBundle in your composer.json
{
"require": {
"davidbadura/fixtures-bundle": "1.0.*"
}
}
Add the DavidBaduraFixturesBundle to your application kernel:
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new DavidBadura\FixturesBundle\DavidBaduraFixturesBundle(),
// ...
);
}
Configure DavidBaduraFixturesBundle:
# app/config/config.yml
david_badura_fixtures:
bundles: [YourBundle]
Activate support for MongoDB:
# app/config/config.yml
david_badura_fixtures:
persister: odm
Now you must create your fixture data:
# @YourBundle/Resource/fixtures/install.yml
user:
properties:
class: "YourBundle\Entity\User"
data:
david:
name: David
email: "d.badura@gmx.de"
groups: ["@group:admin"] # <- reference to group.admin
group:
properties:
class: "YourBundle\Entity\Group"
data:
admin:
name: Admin
member:
name: Member
The fixture files will be automatically loaded from the Resources\fixtures folder.
Command:
php app/console davidbadura:fixtures:load
Service:
$fixtureManager = $container->get('davidbadura_fixtures.fixture_manager');
$fixtureManager->load();
How can I help you explore Laravel packages today?