6
6
namespace Magento \Catalog \Model \Indexer \Product \Flat ;
7
7
8
8
use Magento \Catalog \Api \Data \ProductInterface ;
9
- use Magento \Catalog \Helper \Product \Flat \Indexer ;
10
- use Magento \Catalog \Model \Product \Attribute \Source \Status ;
11
- use Magento \Eav \Model \Entity \Attribute ;
12
- use Magento \Framework \App \Config \ScopeConfigInterface ;
13
- use Magento \Framework \App \ObjectManager ;
14
9
use Magento \Framework \App \ResourceConnection ;
15
- use Magento \Framework \DB \Adapter \AdapterInterface ;
16
- use Magento \Framework \DB \Ddl \Table ;
17
- use Magento \Framework \DB \Select ;
18
10
use Magento \Framework \EntityManager \MetadataPool ;
19
- use Magento \Framework \Exception \LocalizedException ;
20
- use Magento \Store \Model \StoreManagerInterface ;
21
11
22
12
/**
23
13
* Class for building flat index
@@ -37,22 +27,22 @@ class FlatTableBuilder
37
27
const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count ' ;
38
28
39
29
/**
40
- * @var Indexer
30
+ * @var \Magento\Catalog\Helper\Product\Flat\ Indexer
41
31
*/
42
32
protected $ _productIndexerHelper ;
43
33
44
34
/**
45
- * @var AdapterInterface
35
+ * @var \Magento\Framework\DB\Adapter\ AdapterInterface
46
36
*/
47
37
protected $ _connection ;
48
38
49
39
/**
50
- * @var ScopeConfigInterface $config
40
+ * @var \Magento\Framework\App\Config\ ScopeConfigInterface $config
51
41
*/
52
42
protected $ _config ;
53
43
54
44
/**
55
- * @var StoreManagerInterface
45
+ * @var \Magento\Store\Model\ StoreManagerInterface
56
46
*/
57
47
protected $ _storeManager ;
58
48
@@ -62,23 +52,23 @@ class FlatTableBuilder
62
52
protected $ _tableData ;
63
53
64
54
/**
65
- * @var ResourceConnection
55
+ * @var \Magento\Framework\App\ ResourceConnection
66
56
*/
67
57
protected $ resource ;
68
58
69
59
/**
70
- * @param Indexer $productIndexerHelper
60
+ * @param \Magento\Catalog\Helper\Product\Flat\ Indexer $productIndexerHelper
71
61
* @param ResourceConnection $resource
72
- * @param ScopeConfigInterface $config
73
- * @param StoreManagerInterface $storeManager
62
+ * @param \Magento\Framework\App\Config\ ScopeConfigInterface $config
63
+ * @param \Magento\Store\Model\ StoreManagerInterface $storeManager
74
64
* @param TableDataInterface $tableData
75
65
*/
76
66
public function __construct (
77
- Indexer $ productIndexerHelper ,
78
- ResourceConnection $ resource ,
79
- ScopeConfigInterface $ config ,
80
- StoreManagerInterface $ storeManager ,
81
- TableDataInterface $ tableData
67
+ \ Magento \ Catalog \ Helper \ Product \ Flat \ Indexer $ productIndexerHelper ,
68
+ \ Magento \ Framework \ App \ ResourceConnection $ resource ,
69
+ \ Magento \ Framework \ App \ Config \ ScopeConfigInterface $ config ,
70
+ \ Magento \ Store \ Model \ StoreManagerInterface $ storeManager ,
71
+ \ Magento \ Catalog \ Model \ Indexer \ Product \ Flat \ TableDataInterface $ tableData
82
72
) {
83
73
$ this ->_productIndexerHelper = $ productIndexerHelper ;
84
74
$ this ->resource = $ resource ;
@@ -124,8 +114,7 @@ public function build($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix
124
114
*
125
115
* @param int|string $storeId
126
116
* @return void
127
- * @throws LocalizedException
128
- * @throws \Zend_Db_Exception
117
+ * @throws \Magento\Framework\Exception\LocalizedException
129
118
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
130
119
* @SuppressWarnings(PHPMD.NPathComplexity)
131
120
*/
@@ -139,7 +128,7 @@ protected function _createTemporaryFlatTable($storeId)
139
128
self ::XML_NODE_MAX_INDEX_COUNT
140
129
);
141
130
if ($ maxIndex && count ($ indexesNeed ) > $ maxIndex ) {
142
- throw new LocalizedException (
131
+ throw new \ Magento \ Framework \ Exception \ LocalizedException (
143
132
__ (
144
133
'The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes. '
145
134
. 'Currently there are %1$d of them. '
@@ -152,7 +141,7 @@ protected function _createTemporaryFlatTable($storeId)
152
141
153
142
$ indexKeys = [];
154
143
$ indexProps = array_values ($ indexesNeed );
155
- $ upperPrimaryKey = strtoupper (AdapterInterface::INDEX_TYPE_PRIMARY );
144
+ $ upperPrimaryKey = strtoupper (\ Magento \ Framework \ DB \ Adapter \ AdapterInterface::INDEX_TYPE_PRIMARY );
156
145
foreach ($ indexProps as $ i => $ indexProp ) {
157
146
$ indexName = $ this ->_connection ->getIndexName (
158
147
$ this ->_getTemporaryTableName ($ this ->_productIndexerHelper ->getFlatTableName ($ storeId )),
@@ -175,7 +164,7 @@ protected function _createTemporaryFlatTable($storeId)
175
164
}
176
165
$ indexesNeed = array_combine ($ indexKeys , $ indexProps );
177
166
178
- /** @var $table Table */
167
+ /** @var $table \Magento\Framework\DB\Ddl\ Table */
179
168
$ table = $ this ->_connection ->newTable (
180
169
$ this ->_getTemporaryTableName ($ this ->_productIndexerHelper ->getFlatTableName ($ storeId ))
181
170
);
0 commit comments