Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 5710098

Browse files
committed
MAGETWO-71554: Category edit performance issue - for 2.2
1 parent b125e05 commit 5710098

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,32 @@ class IndexBuilder
102102
protected $connection;
103103

104104
/**
105-
* @var \Magento\CatalogRule\Model\Indexer\ProductPriceCalculator
105+
* @var ProductPriceCalculator
106106
*/
107107
private $productPriceCalculator;
108108

109109
/**
110-
* @var \Magento\CatalogRule\Model\Indexer\ReindexRuleProduct
110+
* @var ReindexRuleProduct
111111
*/
112112
private $reindexRuleProduct;
113113

114114
/**
115-
* @var \Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite
115+
* @var ReindexRuleGroupWebsite
116116
*/
117117
private $reindexRuleGroupWebsite;
118118

119119
/**
120-
* @var \Magento\CatalogRule\Model\Indexer\RuleProductsSelectBuilder
120+
* @var RuleProductsSelectBuilder
121121
*/
122122
private $ruleProductsSelectBuilder;
123123

124124
/**
125-
* @var \Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice
125+
* @var ReindexRuleProductPrice
126126
*/
127127
private $reindexRuleProductPrice;
128128

129129
/**
130-
* @var \Magento\CatalogRule\Model\Indexer\RuleProductPricesPersistor
130+
* @var RuleProductPricesPersistor
131131
*/
132132
private $pricesPersistor;
133133

@@ -152,16 +152,15 @@ class IndexBuilder
152152
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
153153
* @param \Magento\Catalog\Model\ProductFactory $productFactory
154154
* @param int $batchCount
155-
* @param \Magento\CatalogRule\Model\Indexer\ProductPriceCalculator|null $productPriceCalculator
156-
* @param \Magento\CatalogRule\Model\Indexer\ReindexRuleProduct|null $reindexRuleProduct
157-
* @param \Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite|null $reindexRuleGroupWebsite
158-
* @param \Magento\CatalogRule\Model\Indexer\RuleProductsSelectBuilder|null $ruleProductsSelectBuilder
159-
* @param \Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice|null $reindexRuleProductPrice
160-
* @param \Magento\CatalogRule\Model\Indexer\RuleProductPricesPersistor|null $pricesPersistor
155+
* @param ProductPriceCalculator|null $productPriceCalculator
156+
* @param ReindexRuleProduct|null $reindexRuleProduct
157+
* @param ReindexRuleGroupWebsite|null $reindexRuleGroupWebsite
158+
* @param RuleProductsSelectBuilder|null $ruleProductsSelectBuilder
159+
* @param ReindexRuleProductPrice|null $reindexRuleProductPrice
160+
* @param RuleProductPricesPersistor|null $pricesPersistor
161161
* @param \Magento\Catalog\Model\ResourceModel\Indexer\ActiveTableSwitcher|null $activeTableSwitcher
162162
* @param ProductLoader|null $productLoader
163163
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
164-
* @SuppressWarnings(PHPMD.NPathComplexity)
165164
*/
166165
public function __construct(
167166
RuleCollectionFactory $ruleCollectionFactory,
@@ -174,12 +173,12 @@ public function __construct(
174173
\Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
175174
\Magento\Catalog\Model\ProductFactory $productFactory,
176175
$batchCount = 1000,
177-
\Magento\CatalogRule\Model\Indexer\ProductPriceCalculator $productPriceCalculator = null,
178-
\Magento\CatalogRule\Model\Indexer\ReindexRuleProduct $reindexRuleProduct = null,
179-
\Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite $reindexRuleGroupWebsite = null,
180-
\Magento\CatalogRule\Model\Indexer\RuleProductsSelectBuilder $ruleProductsSelectBuilder = null,
181-
\Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice $reindexRuleProductPrice = null,
182-
\Magento\CatalogRule\Model\Indexer\RuleProductPricesPersistor $pricesPersistor = null,
176+
ProductPriceCalculator $productPriceCalculator = null,
177+
ReindexRuleProduct $reindexRuleProduct = null,
178+
ReindexRuleGroupWebsite $reindexRuleGroupWebsite = null,
179+
RuleProductsSelectBuilder $ruleProductsSelectBuilder = null,
180+
ReindexRuleProductPrice $reindexRuleProductPrice = null,
181+
RuleProductPricesPersistor $pricesPersistor = null,
183182
\Magento\Catalog\Model\ResourceModel\Indexer\ActiveTableSwitcher $activeTableSwitcher = null,
184183
ProductLoader $productLoader = null
185184
) {
@@ -195,29 +194,30 @@ public function __construct(
195194
$this->productFactory = $productFactory;
196195
$this->batchCount = $batchCount;
197196

198-
$this->productPriceCalculator = $productPriceCalculator ?: ObjectManager::getInstance()->get(
199-
\Magento\CatalogRule\Model\Indexer\ProductPriceCalculator::class
197+
$this->productPriceCalculator = $productPriceCalculator ?? ObjectManager::getInstance()->get(
198+
ProductPriceCalculator::class
200199
);
201-
$this->reindexRuleProduct = $reindexRuleProduct ?: ObjectManager::getInstance()->get(
202-
\Magento\CatalogRule\Model\Indexer\ReindexRuleProduct::class
200+
$this->reindexRuleProduct = $reindexRuleProduct ?? ObjectManager::getInstance()->get(
201+
ReindexRuleProduct::class
203202
);
204-
$this->reindexRuleGroupWebsite = $reindexRuleGroupWebsite ?: ObjectManager::getInstance()->get(
205-
\Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite::class
203+
$this->reindexRuleGroupWebsite = $reindexRuleGroupWebsite ?? ObjectManager::getInstance()->get(
204+
ReindexRuleGroupWebsite::class
206205
);
207-
$this->ruleProductsSelectBuilder = $ruleProductsSelectBuilder ?: ObjectManager::getInstance()->get(
208-
\Magento\CatalogRule\Model\Indexer\RuleProductsSelectBuilder::class
206+
$this->ruleProductsSelectBuilder = $ruleProductsSelectBuilder ?? ObjectManager::getInstance()->get(
207+
RuleProductsSelectBuilder::class
209208
);
210-
$this->reindexRuleProductPrice = $reindexRuleProductPrice ?: ObjectManager::getInstance()->get(
211-
\Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice::class
209+
$this->reindexRuleProductPrice = $reindexRuleProductPrice ?? ObjectManager::getInstance()->get(
210+
ReindexRuleProductPrice::class
212211
);
213-
$this->pricesPersistor = $pricesPersistor ?: ObjectManager::getInstance()->get(
214-
\Magento\CatalogRule\Model\Indexer\RuleProductPricesPersistor::class
212+
$this->pricesPersistor = $pricesPersistor ?? ObjectManager::getInstance()->get(
213+
RuleProductPricesPersistor::class
215214
);
216-
$this->activeTableSwitcher = $activeTableSwitcher ?: ObjectManager::getInstance()->get(
215+
$this->activeTableSwitcher = $activeTableSwitcher ?? ObjectManager::getInstance()->get(
217216
\Magento\Catalog\Model\ResourceModel\Indexer\ActiveTableSwitcher::class
218217
);
219-
$this->productLoader = $productLoader ?:
220-
ObjectManager::getInstance()->get(ProductLoader::class);
218+
$this->productLoader = $productLoader ?? ObjectManager::getInstance()->get(
219+
ProductLoader::class
220+
);
221221
}
222222

223223
/**
@@ -432,7 +432,7 @@ protected function getTable($tableName)
432432
* @param Rule $rule
433433
* @return $this
434434
* @deprecated 100.2.0
435-
* @see \Magento\CatalogRule\Model\Indexer\ReindexRuleProduct::execute
435+
* @see ReindexRuleProduct::execute
436436
*/
437437
protected function updateRuleProductData(Rule $rule)
438438
{
@@ -458,8 +458,8 @@ protected function updateRuleProductData(Rule $rule)
458458
* @throws \Exception
459459
* @return $this
460460
* @deprecated 100.2.0
461-
* @see \Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice::execute
462-
* @see \Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite::execute
461+
* @see ReindexRuleProductPrice::execute
462+
* @see ReindexRuleGroupWebsite::execute
463463
*/
464464
protected function applyAllRules(Product $product = null)
465465
{
@@ -473,7 +473,7 @@ protected function applyAllRules(Product $product = null)
473473
*
474474
* @return $this
475475
* @deprecated 100.2.0
476-
* @see \Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite::execute
476+
* @see ReindexRuleGroupWebsite::execute
477477
*/
478478
protected function updateCatalogRuleGroupWebsiteData()
479479
{
@@ -497,7 +497,7 @@ protected function deleteOldData()
497497
* @param null $productData
498498
* @return float
499499
* @deprecated 100.2.0
500-
* @see \Magento\CatalogRule\Model\Indexer\ProductPriceCalculator::calculate
500+
* @see ProductPriceCalculator::calculate
501501
*/
502502
protected function calcRuleProductPrice($ruleData, $productData = null)
503503
{
@@ -510,7 +510,7 @@ protected function calcRuleProductPrice($ruleData, $productData = null)
510510
* @return \Zend_Db_Statement_Interface
511511
* @throws \Magento\Framework\Exception\LocalizedException
512512
* @deprecated 100.2.0
513-
* @see \Magento\CatalogRule\Model\Indexer\RuleProductsSelectBuilder::build
513+
* @see RuleProductsSelectBuilder::build
514514
*/
515515
protected function getRuleProductsStmt($websiteId, Product $product = null)
516516
{
@@ -522,7 +522,7 @@ protected function getRuleProductsStmt($websiteId, Product $product = null)
522522
* @return $this
523523
* @throws \Exception
524524
* @deprecated 100.2.0
525-
* @see \Magento\CatalogRule\Model\Indexer\RuleProductPricesPersistor::execute
525+
* @see RuleProductPricesPersistor::execute
526526
*/
527527
protected function saveRuleProductPrices($arrData)
528528
{

0 commit comments

Comments
 (0)