17
17
class Collection extends \Magento \Catalog \Model \ResourceModel \Product \Collection implements
18
18
\Magento \Search \Model \SearchCollectionInterface
19
19
{
20
- private const INDEX_USAGE_ENFORCEMENTS = [
21
- 'catalog_product_entity_text ' => 'CATALOG_PRODUCT_ENTITY_TEXT_ROW_ID_ATTRIBUTE_ID_STORE_ID '
22
- ];
20
+ /**
21
+ * @var array
22
+ */
23
+ private $ indexUsageEnforcements ;
23
24
24
25
/**
25
26
* Attribute collection
@@ -65,6 +66,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
65
66
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
66
67
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory
67
68
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
69
+ * @param array $indexUsageEnforcements
68
70
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
69
71
*/
70
72
public function __construct (
@@ -88,7 +90,8 @@ public function __construct(
88
90
\Magento \Framework \Stdlib \DateTime $ dateTime ,
89
91
\Magento \Customer \Api \GroupManagementInterface $ groupManagement ,
90
92
\Magento \Catalog \Model \ResourceModel \Product \Attribute \CollectionFactory $ attributeCollectionFactory ,
91
- \Magento \Framework \DB \Adapter \AdapterInterface $ connection = null
93
+ \Magento \Framework \DB \Adapter \AdapterInterface $ connection = null ,
94
+ array $ indexUsageEnforcements = []
92
95
) {
93
96
$ this ->_attributeCollectionFactory = $ attributeCollectionFactory ;
94
97
parent ::__construct (
@@ -113,6 +116,7 @@ public function __construct(
113
116
$ groupManagement ,
114
117
$ connection
115
118
);
119
+ $ this ->indexUsageEnforcements = $ indexUsageEnforcements ;
116
120
}
117
121
118
122
/**
@@ -209,7 +213,7 @@ protected function _hasAttributeOptionsAndSearchable($attribute)
209
213
private function prepareIndexEnforcements () : array
210
214
{
211
215
$ result = [];
212
- foreach (self :: INDEX_USAGE_ENFORCEMENTS as $ table => $ index ) {
216
+ foreach ($ this -> indexUsageEnforcements as $ table => $ index ) {
213
217
$ table = $ this ->getTable ($ table );
214
218
if ($ this ->isIndexExists ($ table , $ index )) {
215
219
$ result [$ table ] = $ index ;
0 commit comments