Skip to content
Snippets Groups Projects
Unverified Commit 5c2c2ce4 authored by Vadim Justus's avatar Vadim Justus Committed by GitHub
Browse files

Merge pull request #5 from vadimjustus/master

Fix issue with block entities persisting
parents 219f72b2 9fd72e6d
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,6 @@ class ApplyBlockEntry
*/
public function execute(BlockEntryInterface $blockEntry): void
{
try {
$block = $this->getFirstBlockByBlockEntry->execute($blockEntry);
if ($block === null) {
/** @var BlockInterface $page */
......@@ -74,8 +73,5 @@ class ApplyBlockEntry
}
$block->addData($this->normalizeData->execute($blockEntry->getData()));
$this->blockRepository->save($block);
} catch (NoSuchEntityException $e) {
$this->logger->error($e->getMessage(), $e->getTrace());
}
}
}
......@@ -66,7 +66,6 @@ class ApplyPageEntry
*/
public function execute(PageEntryInterface $pageEntry): void
{
try {
$page = $this->getFirstPageByPageEntry->execute($pageEntry);
if ($page === null) {
/** @var PageInterface $page */
......@@ -74,8 +73,5 @@ class ApplyPageEntry
}
$page->addData($this->normalizeData->execute($pageEntry->getData()));
$this->pageRepository->save($page);
} catch (NoSuchEntityException $e) {
$this->logger->error($e->getMessage(), $e->getTrace());
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace Firegento\ContentProvisioning\Model\Command;
use Firegento\ContentProvisioning\Api\Data\EntryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
......@@ -33,11 +34,16 @@ class NormalizeData
public function execute(array $data): array
{
$storeIds = [];
$storeCodes = $data['stores'] ?? [];
$storeCodes = $data[EntryInterface::STORES] ?? [];
foreach ($storeCodes as $code) {
$storeIds[] = $this->storeManager->getStore($code)->getId();
}
$data['stores'] = $storeIds;
$data[EntryInterface::STORES] = $storeIds;
$data['store_id'] = $storeIds;
unset($data[EntryInterface::IS_MAINTAINED]);
unset($data[EntryInterface::KEY]);
return $data;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment