@@ -34,12 +34,23 @@ class DisabledProductOptionPriceModifier implements PriceModifierInterface
34
34
/**
35
35
* @var array
36
36
*/
37
- private $ isBundle = [];
37
+ private $ websiteIdsOfProduct = [];
38
38
39
39
/**
40
- * @var array
40
+ * @var BundleSelection
41
41
*/
42
- private $ websiteIdsOfProduct = [];
42
+ private BundleSelection $ bundleSelection ;
43
+
44
+ /**
45
+ * @var Config
46
+ */
47
+ private Config $ config ;
48
+
49
+ /**
50
+ * @var MetadataPool
51
+ */
52
+ private MetadataPool $ metadataPool ;
53
+
43
54
44
55
/**
45
56
* @param ResourceConnection $resourceConnection
@@ -115,40 +126,19 @@ private function getWebsiteIdsOfProduct(int $entityId): array
115
126
}
116
127
117
128
/**
118
- * Is product bundle
119
- *
120
- * @param int $entityId
121
- * @return bool
122
- */
123
- private function isBundle (int $ entityId ): bool
124
- {
125
- if (isset ($ this ->isBundle [$ entityId ])) {
126
- return $ this ->isBundle [$ entityId ];
127
- }
128
- $ connection = $ this ->resourceConnection ->getConnection ('indexer ' );
129
- $ select = $ connection ->select ();
130
- $ select ->from (
131
- ['cpe ' => $ this ->resourceConnection ->getTableName ('catalog_product_entity ' )],
132
- ['type_id ' ]
133
- )->where ('cpe.entity_id = ? ' , $ entityId );
134
- $ typeId = $ connection ->fetchOne ($ select );
135
- $ this ->isBundle [$ entityId ] = $ typeId === Type::TYPE_BUNDLE ;
136
- return $ this ->isBundle [$ entityId ];
137
- }
138
-
139
- /** Get Bundle Ids
129
+ * Get Bundle Ids
140
130
*
141
131
* @param array $entityIds
142
132
* @return \Traversable
143
133
*/
144
- protected function getBundleIds (array $ entityIds ): \Traversable
134
+ private function getBundleIds (array $ entityIds ): \Traversable
145
135
{
146
136
$ connection = $ this ->resourceConnection ->getConnection ('indexer ' );
147
137
$ select = $ connection ->select ();
148
138
$ select ->from (
149
139
['cpe ' => $ this ->resourceConnection ->getTableName ('catalog_product_entity ' )],
150
140
['entity_id ' ]
151
- )->where ('cpe.entity_id in ( ? ) ' , $ entityIds ?? [0 ], \Zend_Db::INT_TYPE )
141
+ )->where ('cpe.entity_id in ( ? ) ' , ! empty ( $ entityIds) ? $ entityIds : [0 ], \Zend_Db::INT_TYPE )
152
142
->where ('type_id = ? ' , Type::TYPE_BUNDLE );
153
143
154
144
$ statement = $ select ->query ();
0 commit comments