Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-404: Sync with 2.4 - Product Feed index process unknown error #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,7 +53,7 @@ abstract class AbstractProductTestHelper extends \PHPUnit\Framework\TestCase
protected $connection;

/**
* @var Json
* @var GzcompressDecorator
*/
protected $jsonSerializer;

Expand Down Expand Up @@ -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);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/CatalogDataExporter/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
comment="Store view code"
/>
<column
xsi:type="mediumtext"
xsi:type="blob"
name="feed_data"
nullable="false"
comment="Feed Data"
Expand Down Expand Up @@ -72,7 +72,7 @@
length="64"
comment="Store view code"
/>
<column xsi:type="mediumtext"
<column xsi:type="blob"
name="feed_data"
nullable="false"
comment="Feed Data"
Expand Down Expand Up @@ -111,7 +111,7 @@
comment="Store view code"
/>
<column
xsi:type="mediumtext"
xsi:type="blob"
name="feed_data"
nullable="false"
comment="Feed Data"
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/CatalogDataExporter/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@
</arguments>
</virtualType>

<type name="Magento\DataExporter\Model\Feed">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\GzcompressDecorator</argument>
</arguments>
</type>

<type name="Magento\DataExporter\Model\FeedPool">
<arguments>
<argument name="classMap" xsi:type="array">
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/DataExporter/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<argument name="data" xsi:type="object">Magento\DataExporter\Config\Data</argument>
</arguments>
</type>

<type name="Magento\DataExporter\Model\Indexer\DataSerializer">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\GzcompressDecorator</argument>
</arguments>
</type>

<preference for="Magento\DataExporter\Config\ConfigInterface" type="Magento\DataExporter\Config\Config" />

<preference for="Magento\DataExporter\Model\Indexer\FeedIndexerCallbackInterface"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Serialize\Serializer;

use Magento\Framework\Serialize\SerializerInterface;

/**
* Compress data.
*/
class GzcompressDecorator implements SerializerInterface
{
/**
* Json serializer.
*
* @var Json
*/
private $serializer;

/**
* @param Json $serializer
*/
public function __construct(Json $serializer)
{
$this->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));
}
}