Skip to content

Commit 2c6ba19

Browse files
committed
MCP-946: Price Index Optimization
- Fix static tests
1 parent 3a34014 commit 2c6ba19

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price/DisabledProductOptionPriceModifier.php

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,23 @@ class DisabledProductOptionPriceModifier implements PriceModifierInterface
3434
/**
3535
* @var array
3636
*/
37-
private $isBundle = [];
37+
private $websiteIdsOfProduct = [];
3838

3939
/**
40-
* @var array
40+
* @var BundleSelection
4141
*/
42-
private $websiteIdsOfProduct = [];
42+
private BundleSelection $bundleSelection;
43+
44+
/**
45+
* @var Config
46+
*/
47+
private Config $config;
48+
49+
/**
50+
* @var MetadataPool
51+
*/
52+
private MetadataPool $metadataPool;
53+
4354

4455
/**
4556
* @param ResourceConnection $resourceConnection
@@ -115,40 +126,19 @@ private function getWebsiteIdsOfProduct(int $entityId): array
115126
}
116127

117128
/**
118-
* Is product bundle
119-
*
120-
* @param int $entityId
121-
* @return bool
122-
*/
123-
private function isBundle(int $entityId): bool
124-
{
125-
if (isset($this->isBundle[$entityId])) {
126-
return $this->isBundle[$entityId];
127-
}
128-
$connection = $this->resourceConnection->getConnection('indexer');
129-
$select = $connection->select();
130-
$select->from(
131-
['cpe' => $this->resourceConnection->getTableName('catalog_product_entity')],
132-
['type_id']
133-
)->where('cpe.entity_id = ?', $entityId);
134-
$typeId = $connection->fetchOne($select);
135-
$this->isBundle[$entityId] = $typeId === Type::TYPE_BUNDLE;
136-
return $this->isBundle[$entityId];
137-
}
138-
139-
/** Get Bundle Ids
129+
* Get Bundle Ids
140130
*
141131
* @param array $entityIds
142132
* @return \Traversable
143133
*/
144-
protected function getBundleIds(array $entityIds): \Traversable
134+
private function getBundleIds(array $entityIds): \Traversable
145135
{
146136
$connection = $this->resourceConnection->getConnection('indexer');
147137
$select = $connection->select();
148138
$select->from(
149139
['cpe' => $this->resourceConnection->getTableName('catalog_product_entity')],
150140
['entity_id']
151-
)->where('cpe.entity_id in ( ? )', $entityIds ?? [0], \Zend_Db::INT_TYPE)
141+
)->where('cpe.entity_id in ( ? )', !empty($entityIds) ? $entityIds : [0], \Zend_Db::INT_TYPE)
152142
->where('type_id = ?', Type::TYPE_BUNDLE);
153143

154144
$statement = $select->query();

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class Fulltext implements
113113
* @param int|null $batchSize
114114
* @param DeploymentConfig|null $deploymentConfig
115115
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
116+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
116117
*/
117118
public function __construct(
118119
FullFactory $fullActionFactory,

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class Full
226226
* @param \Magento\CatalogSearch\Model\ResourceModel\Fulltext $fulltextResource
227227
* @param \Magento\Framework\Search\Request\DimensionFactory $dimensionFactory
228228
* @param \Magento\Framework\Indexer\ConfigInterface $indexerConfig
229-
* @param null $indexIteratorFactory
229+
* @param mixed $indexIteratorFactory
230230
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
231231
* @param DataProvider|null $dataProvider
232232
* @param int $batchSize

0 commit comments

Comments
 (0)