mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
rdv: update fixtures
This commit is contained in:
parent
6a609eb1ab
commit
cf4f25aaff
@ -42,17 +42,41 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
||||
|
||||
$users = $this->userRepository->findAll();
|
||||
|
||||
foreach ($arr as $a) {
|
||||
$startEvent = new DateTimeImmutable('+'.$a.' days');
|
||||
$endEvent = new DateTimeImmutable('+'.$a.' days + 2 hours');
|
||||
$calendarRange= (new CalendarRange())
|
||||
->setUser($users[array_rand($users, 1)])
|
||||
->setStartDate($startEvent)
|
||||
->setEndDate($endEvent);
|
||||
$days = [
|
||||
'2021-08-23',
|
||||
'2021-08-24',
|
||||
'2021-08-25',
|
||||
'2021-08-26',
|
||||
'2021-08-30',
|
||||
'2021-08-31',
|
||||
'2021-09-01',
|
||||
'2021-09-02',
|
||||
];
|
||||
|
||||
$hours = [
|
||||
'10:00:00',
|
||||
'11:30:00',
|
||||
'13:30:00',
|
||||
'15:00:00'
|
||||
];
|
||||
|
||||
foreach ($users as $u) {
|
||||
foreach ($days as $d) {
|
||||
foreach ($hours as $h){
|
||||
$event = $d.' '.$h;
|
||||
$startEvent = new DateTimeImmutable($event);
|
||||
$endEvent = new DateTimeImmutable($event.' + 1 hours');
|
||||
$calendarRange= (new CalendarRange())
|
||||
->setUser($u)
|
||||
->setStartDate($startEvent)
|
||||
->setEndDate($endEvent);
|
||||
|
||||
$manager->persist($calendarRange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$manager->persist($calendarRange);
|
||||
}
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user