From a07843a1872d58865977a1990b475386d45a5d8e Mon Sep 17 00:00:00 2001 From: uncleempty Date: Tue, 29 Mar 2022 19:04:03 +0300 Subject: [PATCH 1/2] chore: adding exclusions for empty delivery periods. those values should not be synced when empty --- model/publishing/delivery/RemoteDeliveryPublisher.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/model/publishing/delivery/RemoteDeliveryPublisher.php b/model/publishing/delivery/RemoteDeliveryPublisher.php index fbccc26..014d795 100644 --- a/model/publishing/delivery/RemoteDeliveryPublisher.php +++ b/model/publishing/delivery/RemoteDeliveryPublisher.php @@ -56,6 +56,11 @@ class RemoteDeliveryPublisher extends ConfigurableService /** @var core_kernel_classes_Resource */ private $environment; + private const NOT_EMPTY_DELIVERY_PROPERTIES = [ + DeliveryAssemblyService::PROPERTY_START, + DeliveryAssemblyService::PROPERTY_END + ]; + public function publish( core_kernel_classes_Resource $delivery, core_kernel_classes_Resource $environment, @@ -187,6 +192,11 @@ private function getSynchronizedDeliveryProperties(core_kernel_classes_Resource if ($value instanceof core_kernel_classes_Resource) { $value = $value->getUri(); } + + if (empty($value) && in_array($propertyKey, self::NOT_EMPTY_DELIVERY_PROPERTIES)) { + continue; + } + $propertyList[$propertyKey] = (string) $value; } $propertyList[PublishingDeliveryService::ORIGIN_DELIVERY_ID_FIELD] = $delivery->getUri(); From 0a16fb8b1234789ef52dc1d48387ebe67102a13f Mon Sep 17 00:00:00 2001 From: Ilya Yarkavets <32706312+uncleempty@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:30:15 +0300 Subject: [PATCH 2/2] chore: fixed required change Co-authored-by: Andrei Shapiro <59471572+shpran@users.noreply.github.com> --- model/publishing/delivery/RemoteDeliveryPublisher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/publishing/delivery/RemoteDeliveryPublisher.php b/model/publishing/delivery/RemoteDeliveryPublisher.php index 014d795..48041bb 100644 --- a/model/publishing/delivery/RemoteDeliveryPublisher.php +++ b/model/publishing/delivery/RemoteDeliveryPublisher.php @@ -193,7 +193,7 @@ private function getSynchronizedDeliveryProperties(core_kernel_classes_Resource $value = $value->getUri(); } - if (empty($value) && in_array($propertyKey, self::NOT_EMPTY_DELIVERY_PROPERTIES)) { + if (empty($value) && in_array($propertyKey, self::NOT_EMPTY_DELIVERY_PROPERTIES, true)) { continue; }