mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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();
|
$users = $this->userRepository->findAll();
|
||||||
|
|
||||||
foreach ($arr as $a) {
|
$days = [
|
||||||
$startEvent = new DateTimeImmutable('+'.$a.' days');
|
'2021-08-23',
|
||||||
$endEvent = new DateTimeImmutable('+'.$a.' days + 2 hours');
|
'2021-08-24',
|
||||||
$calendarRange= (new CalendarRange())
|
'2021-08-25',
|
||||||
->setUser($users[array_rand($users, 1)])
|
'2021-08-26',
|
||||||
->setStartDate($startEvent)
|
'2021-08-30',
|
||||||
->setEndDate($endEvent);
|
'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();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user