From 5d41b37620408fa2fb22829f88d2ab7e814b03a4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 21 Sep 2023 13:06:19 +0200 Subject: [PATCH] create helper service to exclude accompanying periods from export result based on closing motive --- .../Export/AccompanyingCourseExportHelper.php | 22 +++++++++++++++++++ .../ChillMainBundle/config/services.yaml | 4 ++++ 2 files changed, 26 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php diff --git a/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php b/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php new file mode 100644 index 000000000..dae4ce254 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Export/AccompanyingCourseExportHelper.php @@ -0,0 +1,22 @@ +leftJoin('acp.closingMotive', 'cm') + ->andWhere( + $qb->expr()->orX( + $qb->expr()->eq('cm.isCanceledAccompanyingPeriod', 'false'), + $qb->expr()->isNull('acp.closingMotive') + ) + ); + + return $qb; + } + +} diff --git a/src/Bundle/ChillMainBundle/config/services.yaml b/src/Bundle/ChillMainBundle/config/services.yaml index 5976cb8b0..501a894e6 100644 --- a/src/Bundle/ChillMainBundle/config/services.yaml +++ b/src/Bundle/ChillMainBundle/config/services.yaml @@ -125,3 +125,7 @@ services: Chill\MainBundle\Service\EntityInfo\ViewEntityInfoManager: arguments: $vienEntityInfoProviders: !tagged_iterator chill_main.entity_info_provider + + Chill\MainBundle\Export\AccompanyingCourseExportHelper: + autoconfigure: true + autowire: true