7
7
8
8
use Magento \Directory \Model \Currency ;
9
9
use Magento \Framework \Api \AttributeValueFactory ;
10
+ use Magento \Framework \App \ObjectManager ;
11
+ use Magento \Framework \Locale \ResolverInterface ;
10
12
use Magento \Framework \Pricing \PriceCurrencyInterface ;
11
13
use Magento \Sales \Api \Data \OrderInterface ;
12
14
use Magento \Sales \Api \Data \OrderStatusHistoryInterface ;
@@ -267,6 +269,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
267
269
*/
268
270
protected $ timezone ;
269
271
272
+ /**
273
+ * @var ResolverInterface
274
+ */
275
+ private $ localeResolver ;
276
+
270
277
/**
271
278
* @param \Magento\Framework\Model\Context $context
272
279
* @param \Magento\Framework\Registry $registry
@@ -295,7 +302,9 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
295
302
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
296
303
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
297
304
* @param array $data
305
+ * @param ResolverInterface $localeResolver
298
306
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
307
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
299
308
*/
300
309
public function __construct (
301
310
\Magento \Framework \Model \Context $ context ,
@@ -324,7 +333,8 @@ public function __construct(
324
333
\Magento \Catalog \Model \ResourceModel \Product \CollectionFactory $ productListFactory ,
325
334
\Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
326
335
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
327
- array $ data = []
336
+ array $ data = [],
337
+ ResolverInterface $ localeResolver = null
328
338
) {
329
339
$ this ->_storeManager = $ storeManager ;
330
340
$ this ->_orderConfig = $ orderConfig ;
@@ -335,7 +345,6 @@ public function __construct(
335
345
$ this ->_productVisibility = $ productVisibility ;
336
346
$ this ->invoiceManagement = $ invoiceManagement ;
337
347
$ this ->_currencyFactory = $ currencyFactory ;
338
- $ this ->_eavConfig = $ eavConfig ;
339
348
$ this ->_orderHistoryFactory = $ orderHistoryFactory ;
340
349
$ this ->_addressCollectionFactory = $ addressCollectionFactory ;
341
350
$ this ->_paymentCollectionFactory = $ paymentCollectionFactory ;
@@ -346,6 +355,8 @@ public function __construct(
346
355
$ this ->_trackCollectionFactory = $ trackCollectionFactory ;
347
356
$ this ->salesOrderCollectionFactory = $ salesOrderCollectionFactory ;
348
357
$ this ->priceCurrency = $ priceCurrency ;
358
+ $ this ->localeResolver = $ localeResolver ?: ObjectManager::getInstance ()->get (ResolverInterface::class);
359
+
349
360
parent ::__construct (
350
361
$ context ,
351
362
$ registry ,
@@ -1830,7 +1841,7 @@ public function getCreatedAtFormatted($format)
1830
1841
new \DateTime ($ this ->getCreatedAt ()),
1831
1842
$ format ,
1832
1843
$ format ,
1833
- null ,
1844
+ $ this -> localeResolver -> getDefaultLocale () ,
1834
1845
$ this ->timezone ->getConfigTimezone ('store ' , $ this ->getStore ())
1835
1846
);
1836
1847
}
0 commit comments