11
11
use Magento \Framework \App \ObjectManager ;
12
12
use Magento \Framework \EntityManager \MetadataPool ;
13
13
use Magento \Sales \Model \ConfigInterface ;
14
+ use Magento \Wishlist \Model \ResourceModel \Item \Product \CollectionBuilderInterface ;
14
15
15
16
/**
16
17
* Wishlist item collection
@@ -157,6 +158,10 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
157
158
* @var ConfigInterface
158
159
*/
159
160
private $ salesConfig ;
161
+ /**
162
+ * @var CollectionBuilderInterface
163
+ */
164
+ private $ productCollectionBuilder ;
160
165
161
166
/**
162
167
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
@@ -178,8 +183,8 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
178
183
* @param \Magento\Framework\App\State $appState
179
184
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
180
185
* @param TableMaintainer|null $tableMaintainer
181
- * @param ConfigInterface|null $salesConfig
182
- *
186
+ * @param ConfigInterface|null $salesConfig
187
+ * @param CollectionBuilderInterface|null $productCollectionBuilder
183
188
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
184
189
*/
185
190
public function __construct (
@@ -202,7 +207,8 @@ public function __construct(
202
207
\Magento \Framework \App \State $ appState ,
203
208
\Magento \Framework \DB \Adapter \AdapterInterface $ connection = null ,
204
209
TableMaintainer $ tableMaintainer = null ,
205
- ConfigInterface $ salesConfig = null
210
+ ConfigInterface $ salesConfig = null ,
211
+ ?CollectionBuilderInterface $ productCollectionBuilder = null
206
212
) {
207
213
$ this ->stockConfiguration = $ stockConfiguration ;
208
214
$ this ->_adminhtmlSales = $ adminhtmlSales ;
@@ -219,6 +225,8 @@ public function __construct(
219
225
parent ::__construct ($ entityFactory , $ logger , $ fetchStrategy , $ eventManager , $ connection , $ resource );
220
226
$ this ->tableMaintainer = $ tableMaintainer ?: ObjectManager::getInstance ()->get (TableMaintainer::class);
221
227
$ this ->salesConfig = $ salesConfig ?: ObjectManager::getInstance ()->get (ConfigInterface::class);
228
+ $ this ->productCollectionBuilder = $ productCollectionBuilder
229
+ ?: ObjectManager::getInstance ()->get (CollectionBuilderInterface::class);
222
230
}
223
231
224
232
/**
@@ -309,12 +317,10 @@ protected function _assignProducts()
309
317
$ productCollection ->setVisibility ($ this ->_productVisibility ->getVisibleInSiteIds ());
310
318
}
311
319
312
- $ productCollection ->addPriceData ()
313
- ->addTaxPercents ()
314
- ->addIdFilter ($ this ->_productIds )
315
- ->addAttributeToSelect ($ this ->_wishlistConfig ->getProductAttributes ())
316
- ->addOptionsToResult ()
317
- ->addUrlRewrite ();
320
+ $ productCollection ->addIdFilter ($ this ->_productIds )
321
+ ->addAttributeToSelect ($ this ->_wishlistConfig ->getProductAttributes ());
322
+
323
+ $ productCollection = $ this ->productCollectionBuilder ->build ($ this , $ productCollection );
318
324
319
325
if ($ this ->_productSalable ) {
320
326
$ productCollection = $ this ->_adminhtmlSales ->applySalableProductTypesFilter ($ productCollection );
0 commit comments