Ensure loading of postal code does not fails

This commit is contained in:
2023-08-02 19:45:59 +02:00
parent 009a0326d9
commit f68a163a30
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
{
$arr = range(-50, 50);
echo "Creating calendar range ('plage de disponibilités')\n";
$users = $this->userRepository->findAll();
$location = (new Location())
@@ -69,6 +65,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
$manager->persist($type);
$manager->persist($location);
$now = new DateTimeImmutable();
$days = [
'2021-08-23',
'2021-08-24',
@@ -80,6 +78,10 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
'2021-09-02',
(new DateTimeImmutable('tomorrow'))->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 = [

View File

@@ -357,11 +357,11 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
$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]));
}
if (null !== $code[6]) {
if (null !== ($code[6] ?? null)) {
$c->setPostalCodeSource($code[6]);
}