3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
7
+
6
8
namespace Magento \ConfigurableProduct \Model \ResourceModel \Product \Indexer \Price ;
7
9
10
+ use Magento \Catalog \Model \ResourceModel \Product \BaseSelectProcessorInterface ;
8
11
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \BasePriceModifier ;
9
12
use Magento \Framework \DB \Select ;
10
13
use Magento \Framework \Indexer \DimensionalIndexerInterface ;
14
17
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \IndexTableStructureFactory ;
15
18
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \IndexTableStructure ;
16
19
use Magento \Framework \App \Config \ScopeConfigInterface ;
17
- use Magento \Store \Model \ScopeInterface ;
18
20
use Magento \Framework \App \ObjectManager ;
19
21
use Magento \CatalogInventory \Model \Stock ;
20
- use Magento \CatalogInventory \Model \Configuration ;
21
22
22
23
/**
23
24
* Configurable Products Price Indexer Resource model
@@ -76,6 +77,11 @@ class Configurable implements DimensionalIndexerInterface
76
77
*/
77
78
private $ scopeConfig ;
78
79
80
+ /**
81
+ * @var BaseSelectProcessorInterface
82
+ */
83
+ private $ baseSelectProcessor ;
84
+
79
85
/**
80
86
* @param BaseFinalPrice $baseFinalPrice
81
87
* @param IndexTableStructureFactory $indexTableStructureFactory
@@ -86,6 +92,9 @@ class Configurable implements DimensionalIndexerInterface
86
92
* @param bool $fullReindexAction
87
93
* @param string $connectionName
88
94
* @param ScopeConfigInterface $scopeConfig
95
+ * @param BaseSelectProcessorInterface|null $baseSelectProcessor
96
+ *
97
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
89
98
*/
90
99
public function __construct (
91
100
BaseFinalPrice $ baseFinalPrice ,
@@ -96,7 +105,8 @@ public function __construct(
96
105
BasePriceModifier $ basePriceModifier ,
97
106
$ fullReindexAction = false ,
98
107
$ connectionName = 'indexer ' ,
99
- ScopeConfigInterface $ scopeConfig = null
108
+ ScopeConfigInterface $ scopeConfig = null ,
109
+ ?BaseSelectProcessorInterface $ baseSelectProcessor = null
100
110
) {
101
111
$ this ->baseFinalPrice = $ baseFinalPrice ;
102
112
$ this ->indexTableStructureFactory = $ indexTableStructureFactory ;
@@ -107,6 +117,8 @@ public function __construct(
107
117
$ this ->fullReindexAction = $ fullReindexAction ;
108
118
$ this ->basePriceModifier = $ basePriceModifier ;
109
119
$ this ->scopeConfig = $ scopeConfig ?: ObjectManager::getInstance ()->get (ScopeConfigInterface::class);
120
+ $ this ->baseSelectProcessor = $ baseSelectProcessor ?:
121
+ ObjectManager::getInstance ()->get (BaseSelectProcessorInterface::class);
110
122
}
111
123
112
124
/**
@@ -223,10 +235,7 @@ private function fillTemporaryOptionsTable(string $temporaryOptionsTableName, ar
223
235
[]
224
236
);
225
237
226
- // Does not make sense to extend query if out of stock products won't appear in tables for indexing
227
- if ($ this ->isConfigShowOutOfStock ()) {
228
- $ select = $ this ->filterSelectByInventory ($ select );
229
- }
238
+ $ this ->baseSelectProcessor ->process ($ select );
230
239
231
240
$ select ->columns (
232
241
[
@@ -315,17 +324,4 @@ private function getTable($tableName)
315
324
{
316
325
return $ this ->resource ->getTableName ($ tableName , $ this ->connectionName );
317
326
}
318
-
319
- /**
320
- * Is flag Show Out Of Stock setted
321
- *
322
- * @return bool
323
- */
324
- private function isConfigShowOutOfStock (): bool
325
- {
326
- return $ this ->scopeConfig ->isSetFlag (
327
- Configuration::XML_PATH_SHOW_OUT_OF_STOCK ,
328
- ScopeInterface::SCOPE_STORE
329
- );
330
- }
331
327
}
0 commit comments