@@ -32,7 +32,7 @@ class PurchasedPrice extends Column
32
32
/**
33
33
* @var OrderRepositoryInterface
34
34
*/
35
- private $ order ;
35
+ private $ orderRepository ;
36
36
37
37
/**
38
38
* Constructor
@@ -43,7 +43,7 @@ class PurchasedPrice extends Column
43
43
* @param array $components
44
44
* @param array $data
45
45
* @param Currency $currency
46
- * @param OrderRepositoryInterface $order
46
+ * @param OrderRepositoryInterface $orderRepository
47
47
*/
48
48
public function __construct (
49
49
ContextInterface $ context ,
@@ -52,12 +52,12 @@ public function __construct(
52
52
array $ components = [],
53
53
array $ data = [],
54
54
Currency $ currency = null ,
55
- OrderRepositoryInterface $ order = null
55
+ OrderRepositoryInterface $ orderRepository = null
56
56
) {
57
57
$ this ->priceFormatter = $ priceFormatter ;
58
58
$ this ->currency = $ currency ?: \Magento \Framework \App \ObjectManager::getInstance ()
59
59
->create (Currency::class);
60
- $ this ->order = $ order ?: \Magento \Framework \App \ObjectManager::getInstance ()
60
+ $ this ->orderRepository = $ orderRepository ?: \Magento \Framework \App \ObjectManager::getInstance ()
61
61
->create (OrderRepositoryInterface::class);
62
62
parent ::__construct ($ context , $ uiComponentFactory , $ components , $ data );
63
63
}
@@ -72,9 +72,8 @@ public function prepareDataSource(array $dataSource)
72
72
{
73
73
if (isset ($ dataSource ['data ' ]['items ' ])) {
74
74
foreach ($ dataSource ['data ' ]['items ' ] as & $ item ) {
75
- $ currencyCode = isset ($ item ['order_currency_code ' ])
76
- ? $ item ['order_currency_code ' ]
77
- : $ this ->order ->get ($ item ['order_id ' ])->getOrderCurrencyCode ();
75
+ $ currencyCode = $ item ['order_currency_code ' ]
76
+ ?? $ this ->orderRepository ->get ($ item ['order_id ' ])->getOrderCurrencyCode ();
78
77
$ purchaseCurrency = $ this ->currency ->load ($ currencyCode );
79
78
$ item [$ this ->getData ('name ' )] = $ purchaseCurrency
80
79
->format ($ item [$ this ->getData ('name ' )], [], false );
0 commit comments