@@ -34,12 +34,23 @@ class DisabledProductOptionPriceModifier implements PriceModifierInterface
3434 /**
3535 * @var array
3636 */
37- private $ isBundle = [];
37+ private $ websiteIdsOfProduct = [];
3838
3939 /**
40- * @var array
40+ * @var BundleSelection
4141 */
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+
4354
4455 /**
4556 * @param ResourceConnection $resourceConnection
@@ -115,40 +126,19 @@ private function getWebsiteIdsOfProduct(int $entityId): array
115126 }
116127
117128 /**
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
140130 *
141131 * @param array $entityIds
142132 * @return \Traversable
143133 */
144- protected function getBundleIds (array $ entityIds ): \Traversable
134+ private function getBundleIds (array $ entityIds ): \Traversable
145135 {
146136 $ connection = $ this ->resourceConnection ->getConnection ('indexer ' );
147137 $ select = $ connection ->select ();
148138 $ select ->from (
149139 ['cpe ' => $ this ->resourceConnection ->getTableName ('catalog_product_entity ' )],
150140 ['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 )
152142 ->where ('type_id = ? ' , Type::TYPE_BUNDLE );
153143
154144 $ statement = $ select ->query ();
0 commit comments