Commit b12fb1f8 authored by dj3c1t's avatar dj3c1t

fixtures pour sourceType et authorRole

parent a38e3925
<?php
namespace Dj3c1t\AppBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Dj3c1t\SourceMLBundle\Entity\SourceType;
use Dj3c1t\SourceMLBundle\Entity\AuthorRole;
class LoadSourceMLBaseData implements FixtureInterface {
public function load(ObjectManager $manager) {
$this->loadSourceTypes($manager);
$this->loadAuthorRoles($manager);
}
public function loadSourceTypes(ObjectManager $manager) {
$sourceTypes = array(
"album",
"track",
"source",
);
foreach($sourceTypes as $sourceTypeName) {
$sourceType = new SourceType();
$sourceType->setName($sourceTypeName);
$manager->persist($sourceType);
}
$manager->flush();
}
public function loadAuthorRoles(ObjectManager $manager) {
$authorRoles = array(
"admin",
"editor",
"contributor",
);
foreach($authorRoles as $authorRoleName) {
$authorRole = new AuthorRole();
$authorRole->setName($authorRoleName);
$manager->persist($authorRole);
}
$manager->flush();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment