From accee53f5a1b044b47df920b05529b2c92bcb42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 3 Jul 2022 22:11:32 +0200 Subject: [PATCH] fix loading calendar range fixtures --- .../DataFixtures/ORM/LoadCalendarRange.php | 27 ++++++++++++++++++- .../MSGraphRemoteCalendarConnector.php | 1 - 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php index e708672a9..4fd0e93de 100644 --- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php @@ -12,12 +12,18 @@ declare(strict_types=1); namespace Chill\CalendarBundle\DataFixtures\ORM; use Chill\CalendarBundle\Entity\CalendarRange; +use Chill\MainBundle\Entity\Address; +use Chill\MainBundle\Entity\Country; +use Chill\MainBundle\Entity\Location; +use Chill\MainBundle\Entity\LocationType; +use Chill\MainBundle\Entity\PostalCode; use Chill\MainBundle\Repository\UserRepository; use DateTimeImmutable; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use libphonenumber\PhoneNumberUtil; class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface { @@ -49,6 +55,22 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere $users = $this->userRepository->findAll(); + $location = (new Location()) + ->setAddress($address = new Address()) + ->setName('Centre A') + ->setEmail('centreA@test.chill.social') + ->setLocationType($type = new LocationType()) + ->setPhonenumber1(PhoneNumberUtil::getInstance()->parse('+3287653812')); + $address->setStreet('Rue des Épaules')->setStreetNumber('14') + ->setPostcode($postCode = new PostalCode()); + $postCode->setCode('4145')->setName('Houte-Si-Plout')->setCountry( + $country = (new Country())->setName(['fr' => 'Pays'])->setCountryCode('ZZ') + ); + $manager->persist($country); + $manager->persist($postCode); + $manager->persist($address); + $manager->persist($location); + $days = [ '2021-08-23', '2021-08-24', @@ -58,6 +80,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere '2021-08-31', '2021-09-01', '2021-09-02', + (new DateTimeImmutable('tomorrow'))->format('Y-m-d'), + (new DateTimeImmutable('today'))->format('Y-m-d'), ]; $hours = [ @@ -76,7 +100,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere $calendarRange = (new CalendarRange()) ->setUser($u) ->setStartDate($startEvent) - ->setEndDate($endEvent); + ->setEndDate($endEvent) + ->setLocation($location); $manager->persist($calendarRange); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 0488892ec..8d36a8f8e 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -14,7 +14,6 @@ namespace Chill\CalendarBundle\RemoteCalendar\Connector; use Chill\CalendarBundle\Entity\Calendar; use Chill\CalendarBundle\Entity\CalendarRange; use Chill\CalendarBundle\Entity\Invite; -use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MachineHttpClient; use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MapCalendarToUser; use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserHttpClient; use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserTokenStorage;