mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-18 08:14:24 +00:00
47 lines
1.2 KiB
PHP
47 lines
1.2 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 = [];
|
|
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$arr = [
|
|
['name' => CancelReason::CANCELEDBY_USER],
|
|
['name' => CancelReason::CANCELEDBY_PERSON],
|
|
['name' => CancelReason::CANCELEDBY_DONOTCOUNT],
|
|
];
|
|
|
|
foreach ($arr as $a) {
|
|
print "Creating calendar cancel reason : " . $a['name'] . "\n";
|
|
$cancelReason= (new CancelReason())
|
|
->setCanceledBy($a['name'])
|
|
->setActive(true);
|
|
$manager->persist($cancelReason);
|
|
$reference = 'CancelReason_'.$a['name'];
|
|
$this->addReference($reference, $cancelReason);
|
|
static::$references[] = $reference;
|
|
}
|
|
|
|
$manager->flush();
|
|
}
|
|
}
|