Skip to content

Commit

Permalink
Merge pull request #119 from oat-sa/backport/OATSD-1762/not-sync-deli…
Browse files Browse the repository at this point in the history
…very-periods-when-empty

Backport/oatsd 1762/not sync delivery periods when empty
  • Loading branch information
uncleempty authored Apr 5, 2022
2 parents e826583 + 0a16fb8 commit 7427e4b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions model/publishing/delivery/RemoteDeliveryPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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, true)) {
continue;
}

$propertyList[$propertyKey] = (string) $value;
}
$propertyList[PublishingDeliveryService::ORIGIN_DELIVERY_ID_FIELD] = $delivery->getUri();
Expand Down

0 comments on commit 7427e4b

Please sign in to comment.