diff --git a/vendor/magento/module-downloadable/Model/Link/DeleteHandler.php b/vendor/magento/module-downloadable/Model/Link/DeleteHandler.php index 399550e5f33..c2a3b20ff9e 100644 --- a/vendor/magento/module-downloadable/Model/Link/DeleteHandler.php +++ b/vendor/magento/module-downloadable/Model/Link/DeleteHandler.php @@ -9,7 +9,7 @@ use Magento\Downloadable\Api\LinkRepositoryInterface as LinkRepository; use Magento\Framework\EntityManager\Operation\ExtensionInterface; /** - * Class DeleteHandler + * Delete Handler for Downloadable Product Links. */ class DeleteHandler implements ExtensionInterface { @@ -27,6 +27,8 @@ class DeleteHandler implements ExtensionInterface } /** + * Delete Downloadable Links for the provided Product. + * * @param object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object @@ -41,6 +43,8 @@ class DeleteHandler implements ExtensionInterface foreach ($this->linkRepository->getList($entity->getSku()) as $link) { $this->linkRepository->delete($link->getId()); } + $entity->setDownloadableLinks(null); + return $entity; } } diff --git a/vendor/magento/module-downloadable/Model/Link/ReadHandler.php b/vendor/magento/module-downloadable/Model/Link/ReadHandler.php index a11b38ee3af..d3a2349739c 100644 --- a/vendor/magento/module-downloadable/Model/Link/ReadHandler.php +++ b/vendor/magento/module-downloadable/Model/Link/ReadHandler.php @@ -9,7 +9,7 @@ use Magento\Downloadable\Api\LinkRepositoryInterface as LinkRepository; use Magento\Framework\EntityManager\Operation\ExtensionInterface; /** - * Class ReadHandler + * Read Handler for Downloadable Product Links. */ class ReadHandler implements ExtensionInterface { @@ -27,6 +27,8 @@ class ReadHandler implements ExtensionInterface } /** + * Read Downloadable Links for the provided Product. + * * @param object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object @@ -40,10 +42,9 @@ class ReadHandler implements ExtensionInterface } $entityExtension = $entity->getExtensionAttributes(); $links = $this->linkRepository->getLinksByProduct($entity); - if ($links) { - $entityExtension->setDownloadableProductLinks($links); - } + $entityExtension->setDownloadableProductLinks($links); $entity->setExtensionAttributes($entityExtension); + return $entity; } } diff --git a/vendor/magento/module-downloadable/Model/Sample/DeleteHandler.php b/vendor/magento/module-downloadable/Model/Sample/DeleteHandler.php index b34cedbdda0..d7361b60267 100644 --- a/vendor/magento/module-downloadable/Model/Sample/DeleteHandler.php +++ b/vendor/magento/module-downloadable/Model/Sample/DeleteHandler.php @@ -9,7 +9,7 @@ use Magento\Downloadable\Api\SampleRepositoryInterface as SampleRepository; use Magento\Framework\EntityManager\Operation\ExtensionInterface; /** - * Class DeleteHandler + * Delete Handler for Downloadable Product Samples. */ class DeleteHandler implements ExtensionInterface { @@ -27,6 +27,8 @@ class DeleteHandler implements ExtensionInterface } /** + * Delete Downloadable Samples for the provided Entity. + * * @param object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object @@ -42,6 +44,8 @@ class DeleteHandler implements ExtensionInterface foreach ($this->sampleRepository->getList($entity->getSku()) as $sample) { $this->sampleRepository->delete($sample->getId()); } + $entity->setDownloadableSamples(null); + return $entity; } } diff --git a/vendor/magento/module-downloadable/Model/Sample/ReadHandler.php b/vendor/magento/module-downloadable/Model/Sample/ReadHandler.php index abcefc720ca..4704de24e20 100644 --- a/vendor/magento/module-downloadable/Model/Sample/ReadHandler.php +++ b/vendor/magento/module-downloadable/Model/Sample/ReadHandler.php @@ -9,7 +9,7 @@ use Magento\Downloadable\Api\SampleRepositoryInterface as SampleRepository; use Magento\Framework\EntityManager\Operation\ExtensionInterface; /** - * Class ReadHandler + * Read Handler for Downloadable Product Samples. */ class ReadHandler implements ExtensionInterface { @@ -27,6 +27,8 @@ class ReadHandler implements ExtensionInterface } /** + * Read Downloadable Samples for the provided Entity. + * * @param object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object @@ -40,10 +42,9 @@ class ReadHandler implements ExtensionInterface } $entityExtension = $entity->getExtensionAttributes(); $samples = $this->sampleRepository->getSamplesByProduct($entity); - if ($samples) { - $entityExtension->setDownloadableProductSamples($samples); - } + $entityExtension->setDownloadableProductSamples($samples); $entity->setExtensionAttributes($entityExtension); + return $entity; } }