10
10
use Magento \Framework \Indexer \DimensionalIndexerInterface ;
11
11
use Magento \Framework \EntityManager \MetadataPool ;
12
12
use Magento \Catalog \Model \Indexer \Product \Price \TableMaintainer ;
13
- use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \Query \BaseFinalPrice ;
14
13
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \IndexTableStructureFactory ;
15
14
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \IndexTableStructure ;
16
15
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \Query \JoinAttributeProcessor ;
21
20
/**
22
21
* Bundle products Price indexer resource model
23
22
*
24
- * @author Magento Core Team <core@magentocommerce.com>
25
- *
26
- * @SuppressWarnings(PHPMD.TooManyFields)
27
23
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28
24
*/
29
25
class Price implements DimensionalIndexerInterface
30
26
{
31
- /**
32
- * @var BaseFinalPrice
33
- */
34
- private $ baseFinalPrice ;
35
-
36
27
/**
37
28
* @var IndexTableStructureFactory
38
29
*/
@@ -88,30 +79,23 @@ class Price implements DimensionalIndexerInterface
88
79
*/
89
80
private $ joinAttributeProcessor ;
90
81
91
- /**
92
- * @var \Magento\Eav\Model\Config
93
- */
94
- private $ eavConfig ;
95
-
96
82
/**
97
83
* @var \Magento\Framework\Event\ManagerInterface
98
84
*/
99
- private $ eventManager = null ;
85
+ private $ eventManager ;
100
86
101
87
/**
102
88
* @var \Magento\Framework\Module\Manager
103
89
*/
104
90
private $ moduleManager ;
105
91
106
92
/**
107
- * @param BaseFinalPrice $baseFinalPrice
108
93
* @param IndexTableStructureFactory $indexTableStructureFactory
109
94
* @param TableMaintainer $tableMaintainer
110
95
* @param MetadataPool $metadataPool
111
96
* @param \Magento\Framework\App\ResourceConnection $resource
112
97
* @param BasePriceModifier $basePriceModifier
113
98
* @param JoinAttributeProcessor $joinAttributeProcessor
114
- * @param \Magento\Eav\Model\Config $eavConfig
115
99
* @param \Magento\Framework\Event\ManagerInterface $eventManager
116
100
* @param \Magento\Framework\Module\Manager $moduleManager
117
101
* @param bool $fullReindexAction
@@ -120,20 +104,17 @@ class Price implements DimensionalIndexerInterface
120
104
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
121
105
*/
122
106
public function __construct (
123
- BaseFinalPrice $ baseFinalPrice ,
124
107
IndexTableStructureFactory $ indexTableStructureFactory ,
125
108
TableMaintainer $ tableMaintainer ,
126
109
MetadataPool $ metadataPool ,
127
110
\Magento \Framework \App \ResourceConnection $ resource ,
128
111
BasePriceModifier $ basePriceModifier ,
129
112
JoinAttributeProcessor $ joinAttributeProcessor ,
130
- \Magento \Eav \Model \Config $ eavConfig ,
131
113
\Magento \Framework \Event \ManagerInterface $ eventManager ,
132
114
\Magento \Framework \Module \Manager $ moduleManager ,
133
115
$ fullReindexAction = false ,
134
116
$ connectionName = 'indexer '
135
117
) {
136
- $ this ->baseFinalPrice = $ baseFinalPrice ;
137
118
$ this ->indexTableStructureFactory = $ indexTableStructureFactory ;
138
119
$ this ->tableMaintainer = $ tableMaintainer ;
139
120
$ this ->connectionName = $ connectionName ;
@@ -142,7 +123,6 @@ public function __construct(
142
123
$ this ->fullReindexAction = $ fullReindexAction ;
143
124
$ this ->basePriceModifier = $ basePriceModifier ;
144
125
$ this ->joinAttributeProcessor = $ joinAttributeProcessor ;
145
- $ this ->eavConfig = $ eavConfig ;
146
126
$ this ->eventManager = $ eventManager ;
147
127
$ this ->moduleManager = $ moduleManager ;
148
128
}
@@ -152,7 +132,7 @@ public function __construct(
152
132
*
153
133
* @throws \Exception
154
134
*/
155
- public function executeByDimension (array $ dimensions , \Traversable $ entityIds = null )
135
+ public function executeByDimensions (array $ dimensions , \Traversable $ entityIds )
156
136
{
157
137
$ this ->tableMaintainer ->createMainTmpTable ($ dimensions );
158
138
@@ -261,15 +241,13 @@ private function prepareBundleOptionTable()
261
241
* @param array $dimensions
262
242
* @param int $priceType
263
243
* @param int|array $entityIds the entity ids limitation
264
- * @return $this
244
+ * @return void
265
245
* @throws \Exception
266
246
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
267
247
*/
268
248
private function prepareBundlePriceByType ($ priceType , array $ dimensions , $ entityIds = null )
269
249
{
270
250
$ connection = $ this ->getConnection ();
271
- $ table = $ this ->getBundlePriceTable ();
272
-
273
251
$ select = $ connection ->select ()->from (
274
252
['e ' => $ this ->getTable ('catalog_product_entity ' )],
275
253
['entity_id ' ]
@@ -393,10 +371,8 @@ private function prepareBundlePriceByType($priceType, array $dimensions, $entity
393
371
]
394
372
);
395
373
396
- $ query = $ select ->insertFromSelect ($ table );
374
+ $ query = $ select ->insertFromSelect ($ this -> getBundlePriceTable () );
397
375
$ connection ->query ($ query );
398
-
399
- return $ this ;
400
376
}
401
377
402
378
/**
@@ -405,7 +381,7 @@ private function prepareBundlePriceByType($priceType, array $dimensions, $entity
405
381
* @param IndexTableStructure $priceTable
406
382
* @param array $dimensions
407
383
*
408
- * @return $this
384
+ * @return void
409
385
* @throws \Exception
410
386
*/
411
387
private function calculateBundleOptionPrice ($ priceTable , $ dimensions )
@@ -442,16 +418,14 @@ private function calculateBundleOptionPrice($priceTable, $dimensions)
442
418
$ this ->getConnection ()->delete ($ priceTable ->getTableName ());
443
419
$ this ->applyBundlePrice ($ priceTable );
444
420
$ this ->applyBundleOptionPrice ($ priceTable );
445
-
446
- return $ this ;
447
421
}
448
422
449
423
/**
450
424
* Calculate bundle product selections price by product type
451
425
*
452
426
* @param array $dimensions
453
427
* @param int $priceType
454
- * @return $this
428
+ * @return void
455
429
* @throws \Exception
456
430
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
457
431
*/
@@ -562,19 +536,17 @@ private function calculateBundleSelectionPrice($dimensions, $priceType)
562
536
563
537
$ query = $ select ->insertFromSelect ($ this ->getBundleSelectionTable ());
564
538
$ connection ->query ($ query );
565
-
566
- return $ this ;
567
539
}
568
540
569
541
/**
570
542
* Prepare percentage tier price for bundle products
571
543
*
572
544
* @param array $dimensions
573
- * @param int| array $entityIds
574
- * @return $this
545
+ * @param array $entityIds
546
+ * @return void
575
547
* @throws \Exception
576
548
*/
577
- private function prepareTierPriceIndex ($ dimensions , $ entityIds = null )
549
+ private function prepareTierPriceIndex ($ dimensions , $ entityIds )
578
550
{
579
551
$ connection = $ this ->getConnection ();
580
552
$ metadata = $ this ->metadataPool ->getMetadata (ProductInterface::class);
@@ -634,8 +606,6 @@ private function prepareTierPriceIndex($dimensions, $entityIds = null)
634
606
635
607
$ query = $ select ->insertFromSelect ($ this ->getTable ('catalog_product_index_tier_price ' ));
636
608
$ connection ->query ($ query );
637
-
638
- return $ this ;
639
609
}
640
610
641
611
/**
0 commit comments