From 9e9feace80359a3b626c33d871943b763cd6f056 Mon Sep 17 00:00:00 2001 From: Vitaliy Honcharenko Date: Wed, 11 Nov 2020 17:04:24 -0600 Subject: [PATCH] ISSUE-404: Sync with 2.4 - Product Feed index process unknown error --- .../Integration/AbstractProductTestHelper.php | 6 +-- .../CatalogDataExporter/etc/db_schema.xml | 6 +-- .../Magento/CatalogDataExporter/etc/di.xml | 6 +++ app/code/Magento/DataExporter/etc/di.xml | 7 +++ .../Serialize/GzcompressDecorator.php | 45 +++++++++++++++++++ 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 lib/internal/Magento/Framework/Serialize/Serialize/GzcompressDecorator.php diff --git a/app/code/Magento/CatalogDataExporter/Test/Integration/AbstractProductTestHelper.php b/app/code/Magento/CatalogDataExporter/Test/Integration/AbstractProductTestHelper.php index 107ca1739..1d7d8a280 100644 --- a/app/code/Magento/CatalogDataExporter/Test/Integration/AbstractProductTestHelper.php +++ b/app/code/Magento/CatalogDataExporter/Test/Integration/AbstractProductTestHelper.php @@ -16,7 +16,7 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Serialize\Serializer\GzcompressDecorator; use Magento\Framework\UrlInterface; use Magento\Indexer\Model\Indexer; use Magento\Store\Model\StoreManagerInterface; @@ -53,7 +53,7 @@ abstract class AbstractProductTestHelper extends \PHPUnit\Framework\TestCase protected $connection; /** - * @var Json + * @var GzcompressDecorator */ protected $jsonSerializer; @@ -104,7 +104,7 @@ protected function setUp(): void $this->storeManager = Bootstrap::getObjectManager()->create(StoreManagerInterface::class); $this->taxClassSource = Bootstrap::getObjectManager()->create(TaxClassSource::class); - $this->jsonSerializer = Bootstrap::getObjectManager()->create(Json::class); + $this->jsonSerializer = Bootstrap::getObjectManager()->create(GzcompressDecorator::class); } /** diff --git a/app/code/Magento/CatalogDataExporter/etc/db_schema.xml b/app/code/Magento/CatalogDataExporter/etc/db_schema.xml index f127827db..c75912da9 100644 --- a/app/code/Magento/CatalogDataExporter/etc/db_schema.xml +++ b/app/code/Magento/CatalogDataExporter/etc/db_schema.xml @@ -29,7 +29,7 @@ comment="Store view code" /> - + + + Magento\Framework\Serialize\Serializer\GzcompressDecorator + + + diff --git a/app/code/Magento/DataExporter/etc/di.xml b/app/code/Magento/DataExporter/etc/di.xml index a38c8fb11..dd38db22f 100644 --- a/app/code/Magento/DataExporter/etc/di.xml +++ b/app/code/Magento/DataExporter/etc/di.xml @@ -33,6 +33,13 @@ Magento\DataExporter\Config\Data + + + + Magento\Framework\Serialize\Serializer\GzcompressDecorator + + + serializer = $serializer; + } + + /** + * @inheritDoc + */ + public function serialize($data) + { + return gzcompress($this->serializer->serialize($data), 9); + } + + /** + * @inheritDoc + */ + public function unserialize($string) + { + return $this->serializer->unserialize(gzuncompress($string)); + } +}