mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
rdv: adapt entities + add fixtures
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Invite;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
|
||||
class LoadInvite extends Fixture implements FixtureGroupInterface
|
||||
{
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 40002;
|
||||
}
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
return ['calendar'];
|
||||
}
|
||||
|
||||
public static $references = array();
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$arr = array(
|
||||
array('name' => array('fr' => 'Rendez-vous décliné')),
|
||||
array('name' => array('fr' => 'Rendez-vous accepté')),
|
||||
);
|
||||
|
||||
foreach ($arr as $a) {
|
||||
print "Creating calendar invite : " . $a['name']['fr'] . "\n";
|
||||
$invite= (new Invite())
|
||||
->setStatus($a['name']);
|
||||
$manager->persist($invite);
|
||||
$reference = 'Invite_'.$a['name']['fr'];
|
||||
$this->addReference($reference, $invite);
|
||||
static::$references[] = $reference;
|
||||
}
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user