Ensure loading of postal code does not fails

This commit is contained in:
Julien Fastré 2023-08-02 19:45:59 +02:00
parent 009a0326d9
commit f68a163a30
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
5 changed files with 33 additions and 6 deletions

View File

@ -45,10 +45,6 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
$arr = range(-50, 50);
echo "Creating calendar range ('plage de disponibilités')\n";
$users = $this->userRepository->findAll(); $users = $this->userRepository->findAll();
$location = (new Location()) $location = (new Location())
@ -69,6 +65,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
$manager->persist($type); $manager->persist($type);
$manager->persist($location); $manager->persist($location);
$now = new DateTimeImmutable();
$days = [ $days = [
'2021-08-23', '2021-08-23',
'2021-08-24', '2021-08-24',
@ -80,6 +78,10 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
'2021-09-02', '2021-09-02',
(new DateTimeImmutable('tomorrow'))->format('Y-m-d'), (new DateTimeImmutable('tomorrow'))->format('Y-m-d'),
(new DateTimeImmutable('today'))->format('Y-m-d'), (new DateTimeImmutable('today'))->format('Y-m-d'),
$now->add(new \DateInterval('P7D'))->format('Y-m-d'),
$now->add(new \DateInterval('P8D'))->format('Y-m-d'),
$now->add(new \DateInterval('P9D'))->format('Y-m-d'),
$now->add(new \DateInterval('P10D'))->format('Y-m-d'),
]; ];
$hours = [ $hours = [

View File

@ -357,11 +357,11 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
$c->setRefPostalCodeId($code[3]); $c->setRefPostalCodeId($code[3]);
} }
if (null !== $code[4] & null !== $code[5]) { if (null !== ($code[4] ?? null) & null !== ($code[5] ?? null)) {
$c->setCenter(Point::fromLonLat((float) $code[5], (float) $code[4])); $c->setCenter(Point::fromLonLat((float) $code[5], (float) $code[4]));
} }
if (null !== $code[6]) { if (null !== ($code[6] ?? null)) {
$c->setPostalCodeSource($code[6]); $c->setPostalCodeSource($code[6]);
} }

View File

@ -0,0 +1,4 @@
framework:
messenger:
transports:
async: 'in-memory://'

View File

@ -0,0 +1,15 @@
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
# failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
# async: '%env(MESSENGER_TRANSPORT_DSN)%'
# failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
# Route your messages to the transports
'Chill\CalendarBundle\Messenger\Message\CalendarRangeMessage': async
# 'App\Message\YourMessage': async

View File

@ -0,0 +1,6 @@
framework:
messenger:
transports:
async: 'in-memory://'
failed: 'in-memory://'
sync: 'in-memory://'