1717class Collection extends \Magento \Catalog \Model \ResourceModel \Product \Collection implements
1818 \Magento \Search \Model \SearchCollectionInterface
1919{
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 ;
2324
2425 /**
2526 * Attribute collection
@@ -65,6 +66,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
6566 * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
6667 * @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory
6768 * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
69+ * @param array $indexUsageEnforcements
6870 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
6971 */
7072 public function __construct (
@@ -88,7 +90,8 @@ public function __construct(
8890 \Magento \Framework \Stdlib \DateTime $ dateTime ,
8991 \Magento \Customer \Api \GroupManagementInterface $ groupManagement ,
9092 \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 = []
9295 ) {
9396 $ this ->_attributeCollectionFactory = $ attributeCollectionFactory ;
9497 parent ::__construct (
@@ -113,6 +116,7 @@ public function __construct(
113116 $ groupManagement ,
114117 $ connection
115118 );
119+ $ this ->indexUsageEnforcements = $ indexUsageEnforcements ;
116120 }
117121
118122 /**
@@ -209,7 +213,7 @@ protected function _hasAttributeOptionsAndSearchable($attribute)
209213 private function prepareIndexEnforcements () : array
210214 {
211215 $ result = [];
212- foreach (self :: INDEX_USAGE_ENFORCEMENTS as $ table => $ index ) {
216+ foreach ($ this -> indexUsageEnforcements as $ table => $ index ) {
213217 $ table = $ this ->getTable ($ table );
214218 if ($ this ->isIndexExists ($ table , $ index )) {
215219 $ result [$ table ] = $ index ;
0 commit comments