From 91494c07d5836c53b6b2051ae20c75966cd08185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 11 Jan 2023 16:55:03 +0100 Subject: [PATCH] Fixed: [export][Agreggator by type] handle correctly case when an acp or an activity does not have any location type --- .../Aggregator/ACPAggregators/LocationTypeAggregator.php | 6 ++++-- .../Export/Aggregator/LocationTypeAggregator.php | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index b648fcf83..ec4ce6315 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -65,11 +65,13 @@ class LocationTypeAggregator implements AggregatorInterface return 'Accepted locationtype'; } - if (null === $value) { + if (null === $value || '' === $value) { return ''; } - $lt = $this->locationTypeRepository->find($value); + if (null === $lt = $this->locationTypeRepository->find($value)) { + return ''; + } return $this->translatableStringHelper->localize( $lt->getTitle() diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index b23b304f6..6574e3934 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -66,7 +66,13 @@ final class LocationTypeAggregator implements AggregatorInterface return 'Location type'; } - $j = $this->locationTypeRepository->find($value); + if (null === $value || '' === $value) { + return ''; + } + + if (null === $j = $this->locationTypeRepository->find($value)) { + return ''; + } return $this->translatableStringHelper->localize( $j->getTitle()