mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix loading calendar range fixtures
This commit is contained in:
parent
20b70f9eed
commit
accee53f5a
@ -12,12 +12,18 @@ declare(strict_types=1);
|
|||||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Entity\CalendarRange;
|
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 Chill\MainBundle\Repository\UserRepository;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use libphonenumber\PhoneNumberUtil;
|
||||||
|
|
||||||
class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface
|
class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface
|
||||||
{
|
{
|
||||||
@ -49,6 +55,22 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
|||||||
|
|
||||||
$users = $this->userRepository->findAll();
|
$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 = [
|
$days = [
|
||||||
'2021-08-23',
|
'2021-08-23',
|
||||||
'2021-08-24',
|
'2021-08-24',
|
||||||
@ -58,6 +80,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
|||||||
'2021-08-31',
|
'2021-08-31',
|
||||||
'2021-09-01',
|
'2021-09-01',
|
||||||
'2021-09-02',
|
'2021-09-02',
|
||||||
|
(new DateTimeImmutable('tomorrow'))->format('Y-m-d'),
|
||||||
|
(new DateTimeImmutable('today'))->format('Y-m-d'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$hours = [
|
$hours = [
|
||||||
@ -76,7 +100,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
|||||||
$calendarRange = (new CalendarRange())
|
$calendarRange = (new CalendarRange())
|
||||||
->setUser($u)
|
->setUser($u)
|
||||||
->setStartDate($startEvent)
|
->setStartDate($startEvent)
|
||||||
->setEndDate($endEvent);
|
->setEndDate($endEvent)
|
||||||
|
->setLocation($location);
|
||||||
|
|
||||||
$manager->persist($calendarRange);
|
$manager->persist($calendarRange);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ namespace Chill\CalendarBundle\RemoteCalendar\Connector;
|
|||||||
use Chill\CalendarBundle\Entity\Calendar;
|
use Chill\CalendarBundle\Entity\Calendar;
|
||||||
use Chill\CalendarBundle\Entity\CalendarRange;
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||||
use Chill\CalendarBundle\Entity\Invite;
|
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\MapCalendarToUser;
|
||||||
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserHttpClient;
|
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserHttpClient;
|
||||||
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserTokenStorage;
|
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\OnBehalfOfUserTokenStorage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user