From 1a916759fb5a05d595d5da956116ed2848f0776f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krispin=20L=C3=BCtjann?= Date: Thu, 9 Apr 2020 14:49:33 +0200 Subject: [PATCH 1/2] NTR - Fix event listener --- .../Events/MerchantPageCriteriaListener.php | 26 +++++++++++++++ .../ServiceBookingTemplateCriteriaLoader.php | 32 ------------------- src/Resources/config/services.xml | 5 ++- 3 files changed, 28 insertions(+), 35 deletions(-) create mode 100644 src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php delete mode 100644 src/Core/Content/Merchant/Storefront/Service/ServiceBookingTemplateCriteriaLoader.php diff --git a/src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php b/src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php new file mode 100644 index 0000000..343d0ef --- /dev/null +++ b/src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php @@ -0,0 +1,26 @@ + 'loadMerchant', + ]; + } + + public function loadMerchant(MerchantPageCriteriaEvent $event): Criteria + { + $criteria = $event->getCriteria(); + + $criteria->addAssociation('products.serviceBookingTemplate.dates'); + + return $criteria; + } +} diff --git a/src/Core/Content/Merchant/Storefront/Service/ServiceBookingTemplateCriteriaLoader.php b/src/Core/Content/Merchant/Storefront/Service/ServiceBookingTemplateCriteriaLoader.php deleted file mode 100644 index 120bf9d..0000000 --- a/src/Core/Content/Merchant/Storefront/Service/ServiceBookingTemplateCriteriaLoader.php +++ /dev/null @@ -1,32 +0,0 @@ - - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Swag\ServiceBooking\Core\Content\Merchant\Storefront\Service; - -use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Production\Merchants\Content\Merchant\Storefront\Service\MerchantCriteriaLoaderInterface; - -class ServiceBookingTemplateCriteriaLoader implements MerchantCriteriaLoaderInterface -{ - /** - * @var MerchantCriteriaLoaderInterface - */ - private $criteriaLoader; - - public function __construct(MerchantCriteriaLoaderInterface $criteriaLoader) - { - $this->criteriaLoader = $criteriaLoader; - } - - public function getMerchantCriteria(Criteria $criteria): Criteria - { - $criteria = $this->criteriaLoader->getMerchantCriteria($criteria); - $criteria->addAssociation('products.serviceBookingTemplate.dates'); - - return $criteria; - } -} diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 6f2294a..ee3c21e 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -4,9 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - + + From c906607af9049810218e0724f56f369f6eecc000 Mon Sep 17 00:00:00 2001 From: Stephan Pohl Date: Tue, 14 Apr 2020 09:03:56 +0200 Subject: [PATCH 2/2] NTR - Fixes event subscriber --- .../Events/MerchantPageCriteriaListener.php | 5 ++--- src/Resources/config/services.xml | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) rename src/Core/Content/Merchant/{ => Storefront}/Events/MerchantPageCriteriaListener.php (94%) diff --git a/src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php b/src/Core/Content/Merchant/Storefront/Events/MerchantPageCriteriaListener.php similarity index 94% rename from src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php rename to src/Core/Content/Merchant/Storefront/Events/MerchantPageCriteriaListener.php index 343d0ef..1171061 100644 --- a/src/Core/Content/Merchant/Events/MerchantPageCriteriaListener.php +++ b/src/Core/Content/Merchant/Storefront/Events/MerchantPageCriteriaListener.php @@ -15,12 +15,11 @@ public static function getSubscribedEvents(): array ]; } - public function loadMerchant(MerchantPageCriteriaEvent $event): Criteria + public function loadMerchant(MerchantPageCriteriaEvent $event): void { $criteria = $event->getCriteria(); $criteria->addAssociation('products.serviceBookingTemplate.dates'); - - return $criteria; + } } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index ee3c21e..14463de 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -4,10 +4,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - - - @@ -33,6 +29,10 @@ + + + +