Skip to content

Commit 82c06be

Browse files
committed
Fixed wrong fixes of the categoryMetadata
1 parent 4c901e6 commit 82c06be

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,30 @@ class AbstractAction
7979
/**
8080
* @var SkipStaticColumnsProvider
8181
*/
82-
private $staticColumnsProvider;
82+
private $skipStaticColumnsProvider;
8383

8484
/**
8585
* @param ResourceConnection $resource
8686
* @param StoreManagerInterface $storeManager
8787
* @param Helper $resourceHelper
88-
* @param MetadataPool|null $categoryMetadata
89-
* @param SkipStaticColumnsProvider|null $provider
88+
* @param MetadataPool|null $metadataPool
89+
* @param SkipStaticColumnsProvider|null $skipStaticColumnsProvider
9090
*/
9191
public function __construct(
9292
ResourceConnection $resource,
9393
StoreManagerInterface $storeManager,
9494
Helper $resourceHelper,
95-
MetadataPool $categoryMetadata = null,
96-
SkipStaticColumnsProvider $provider = null
95+
MetadataPool $metadataPool = null,
96+
SkipStaticColumnsProvider $skipStaticColumnsProvider = null
9797
) {
9898
$this->resource = $resource;
9999
$this->connection = $resource->getConnection();
100100
$this->storeManager = $storeManager;
101101
$this->resourceHelper = $resourceHelper;
102-
$this->categoryMetadata = $categoryMetadata ?: ObjectManager::getInstance()->get(MetadataPool::class);
103-
$this->staticColumnsProvider = $provider ?: ObjectManager::getInstance()->get(SkipStaticColumnsProvider::class);
102+
$metadataPool = $metadataPool ?? ObjectManager::getInstance()->get(MetadataPool::class);
103+
$this->categoryMetadata = $metadataPool->getMetadata(CategoryInterface::class);
104+
$this->skipStaticColumnsProvider = $skipStaticColumnsProvider
105+
?? ObjectManager::getInstance()->get(SkipStaticColumnsProvider::class);
104106
$this->columns = array_merge($this->getStaticColumns(), $this->getEavColumns());
105107
}
106108

@@ -522,14 +524,14 @@ protected function getTableName($name)
522524
}
523525

524526
/**
525-
* Get skip static columns instance.
527+
* Gets skipped static columns.
526528
*
527529
* @return array
528530
*/
529531
private function getSkipStaticColumns()
530532
{
531-
if ([] === $this->skipStaticColumns) {
532-
$this->skipStaticColumns = $this->staticColumnsProvider->get();
533+
if ($this->skipStaticColumns === []) {
534+
$this->skipStaticColumns = $this->skipStaticColumnsProvider->get();
533535
}
534536
return $this->skipStaticColumns;
535537
}

0 commit comments

Comments
 (0)