mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
@@ -14,34 +19,33 @@ use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
|
||||
class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface
|
||||
{
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public static array $references = [];
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 40003;
|
||||
}
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
return ['calendar'];
|
||||
}
|
||||
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 40003;
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$arr = range(-50, 50);
|
||||
|
||||
print "Creating calendar range ('plage de disponibilités')\n";
|
||||
echo "Creating calendar range ('plage de disponibilités')\n";
|
||||
|
||||
$users = $this->userRepository->findAll();
|
||||
|
||||
@@ -60,25 +64,23 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
||||
'10:00:00',
|
||||
'11:30:00',
|
||||
'13:30:00',
|
||||
'15:00:00'
|
||||
'15:00:00',
|
||||
];
|
||||
|
||||
foreach ($users as $u) {
|
||||
foreach ($days as $d) {
|
||||
foreach ($hours as $h){
|
||||
$event = $d.' '.$h;
|
||||
foreach ($hours as $h) {
|
||||
$event = $d . ' ' . $h;
|
||||
$startEvent = new DateTimeImmutable($event);
|
||||
$endEvent = new DateTimeImmutable($event.' + 1 hours');
|
||||
$calendarRange= (new CalendarRange())
|
||||
$endEvent = new DateTimeImmutable($event . ' + 1 hours');
|
||||
$calendarRange = (new CalendarRange())
|
||||
->setUser($u)
|
||||
->setStartDate($startEvent)
|
||||
->setEndDate($endEvent);
|
||||
|
||||
$manager->persist($calendarRange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$manager->flush();
|
||||
}
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\CalendarBundle\Entity\CancelReason;
|
||||
@@ -7,20 +14,19 @@ 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 $references = [];
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
return ['calendar'];
|
||||
}
|
||||
|
||||
public static $references = [];
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 40001;
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
@@ -31,12 +37,12 @@ class LoadCancelReason extends Fixture implements FixtureGroupInterface
|
||||
];
|
||||
|
||||
foreach ($arr as $a) {
|
||||
print "Creating calendar cancel reason : " . $a['name'] . "\n";
|
||||
$cancelReason= (new CancelReason())
|
||||
echo 'Creating calendar cancel reason : ' . $a['name'] . "\n";
|
||||
$cancelReason = (new CancelReason())
|
||||
->setCanceledBy($a['name'])
|
||||
->setActive(true);
|
||||
$manager->persist($cancelReason);
|
||||
$reference = 'CancelReason_'.$a['name'];
|
||||
$reference = 'CancelReason_' . $a['name'];
|
||||
$this->addReference($reference, $cancelReason);
|
||||
static::$references[] = $reference;
|
||||
}
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Invite;
|
||||
@@ -7,20 +14,19 @@ 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 $references = [];
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
return ['calendar'];
|
||||
}
|
||||
|
||||
public static $references = [];
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 40002;
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
@@ -30,11 +36,11 @@ class LoadInvite extends Fixture implements FixtureGroupInterface
|
||||
];
|
||||
|
||||
foreach ($arr as $a) {
|
||||
print "Creating calendar invite : " . $a['name']['fr'] . "\n";
|
||||
$invite= (new Invite())
|
||||
echo 'Creating calendar invite : ' . $a['name']['fr'] . "\n";
|
||||
$invite = (new Invite())
|
||||
->setStatus($a['name']);
|
||||
$manager->persist($invite);
|
||||
$reference = 'Invite_'.$a['name']['fr'];
|
||||
$reference = 'Invite_' . $a['name']['fr'];
|
||||
$this->addReference($reference, $invite);
|
||||
static::$references[] = $reference;
|
||||
}
|
||||
|
Reference in New Issue
Block a user