File tree Expand file tree Collapse file tree 5 files changed +17
-25
lines changed
Catalog/Model/Product/Configuration/Item Expand file tree Collapse file tree 5 files changed +17
-25
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \Catalog \Model \Product \Configuration \Item ;
9
9
10
10
use Magento \Catalog \Api \Data \ProductInterface ;
11
+ use Magento \Framework \App \ObjectManager ;
11
12
12
13
/**
13
14
* {@inheritdoc}
14
15
*/
15
16
class ItemResolverComposite implements ItemResolverInterface
16
17
{
17
- /** @var ItemResolverInterface [] */
18
+ /** @var string [] */
18
19
private $ itemResolvers = [];
19
20
20
21
/**
21
- * @param ItemResolverInterface [] $itemResolvers
22
+ * @param string [] $itemResolvers
22
23
*/
23
24
public function __construct (array $ itemResolvers )
24
25
{
@@ -32,12 +33,23 @@ public function getFinalProduct(ItemInterface $item) : ProductInterface
32
33
{
33
34
$ product = $ item ->getProduct ();
34
35
foreach ($ this ->itemResolvers as $ resolver ) {
35
- $ resolvedProduct = $ resolver ->getFinalProduct ($ item );
36
+ $ resolvedProduct = $ this -> getItemResolverInstance ( $ resolver) ->getFinalProduct ($ item );
36
37
if ($ resolvedProduct !== $ product ) {
37
38
$ product = $ resolvedProduct ;
38
39
break ;
39
40
}
40
41
}
41
42
return $ product ;
42
43
}
44
+
45
+ /**
46
+ * Get the instance of the item resolver by class name
47
+ *
48
+ * @param string $className
49
+ * @return ItemResolverInterface
50
+ */
51
+ private function getItemResolverInstance (string $ className )
52
+ {
53
+ return ObjectManager::getInstance ()->get ($ className );
54
+ }
43
55
}
Original file line number Diff line number Diff line change @@ -57,16 +57,6 @@ public function getOptionList()
57
57
return $ this ->_productConfig ->getOptions ($ this ->getItem ());
58
58
}
59
59
60
- /**
61
- * {@inheritdoc}
62
- * @deprecated because now parent handles the logic for images of all product types
63
- * @see \Magento\Checkout\Block\Cart\Item\Renderer::getProductForThumbnail
64
- */
65
- public function getProductForThumbnail ()
66
- {
67
- return parent ::getProductForThumbnail ();
68
- }
69
-
70
60
/**
71
61
* Return identifiers for produced content
72
62
*
Original file line number Diff line number Diff line change 208
208
<type name =" Magento\Catalog\Model\Product\Configuration\Item\ItemResolverComposite" >
209
209
<arguments >
210
210
<argument name =" itemResolvers" xsi : type =" array" >
211
- <item name =" configurable" xsi : type =" object " >Magento\ConfigurableProduct\Model\Product\Configuration\Item\ItemProductResolver</item >
211
+ <item name =" configurable" xsi : type =" string " >Magento\ConfigurableProduct\Model\Product\Configuration\Item\ItemProductResolver</item >
212
212
</argument >
213
213
</arguments >
214
214
</type >
Original file line number Diff line number Diff line change @@ -38,16 +38,6 @@ public function getGroupedProduct()
38
38
return $ this ->getProduct ();
39
39
}
40
40
41
- /**
42
- * {@inheritdoc}
43
- * @deprecated because now parent handles the logic for images of all product types
44
- * @see \Magento\Checkout\Block\Cart\Item\Renderer::getProductForThumbnail
45
- */
46
- public function getProductForThumbnail ()
47
- {
48
- return parent ::getProductForThumbnail ();
49
- }
50
-
51
41
/**
52
42
* Return identifiers for produced content
53
43
*
Original file line number Diff line number Diff line change 103
103
<type name =" Magento\Catalog\Model\Product\Configuration\Item\ItemResolverComposite" >
104
104
<arguments >
105
105
<argument name =" itemResolvers" xsi : type =" array" >
106
- <item name =" grouped" xsi : type =" object " >Magento\GroupedProduct\Model\Product\Configuration\Item\ItemProductResolver</item >
106
+ <item name =" grouped" xsi : type =" string " >Magento\GroupedProduct\Model\Product\Configuration\Item\ItemProductResolver</item >
107
107
</argument >
108
108
</arguments >
109
109
</type >
You can’t perform that action at this time.
0 commit comments