mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
|
|
|
use Chill\CalendarBundle\Entity\CancelReason;
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
|
|
|
|
class LoadCancelReason extends Fixture implements FixtureGroupInterface
|
|
{
|
|
public function getOrder(): int
|
|
{
|
|
return 40001;
|
|
}
|
|
|
|
public static function getGroups(): array
|
|
{
|
|
return ['calendar'];
|
|
}
|
|
|
|
public static $references = array();
|
|
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$arr = array(
|
|
array('name' => array('fr' => 'Annulé par l\'utilisateur')),
|
|
array('name' => array('fr' => 'Annulé par l\'usager')),
|
|
array('name' => array('fr' => 'Ne pas comptabiliser')),
|
|
);
|
|
|
|
foreach ($arr as $a) {
|
|
print "Creating calendar cancel reason : " . $a['name']['fr'] . "\n";
|
|
$cancelReason= (new CancelReason())
|
|
->setCanceledBy($a['name'])
|
|
->setActive(true);
|
|
$manager->persist($cancelReason);
|
|
$reference = 'CancelReason_'.$a['name']['fr'];
|
|
$this->addReference($reference, $cancelReason);
|
|
static::$references[] = $reference;
|
|
}
|
|
|
|
$manager->flush();
|
|
}
|
|
}
|