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 ;
@@ -212,6 +214,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
212
214
*/
213
215
protected $ _currencyFactory ;
214
216
217
+ /**
218
+ * @var \Magento\Eav\Model\Config
219
+ */
220
+ private $ _eavConfig ;
221
+
215
222
/**
216
223
* @var \Magento\Sales\Model\Order\Status\HistoryFactory
217
224
*/
@@ -267,6 +274,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
267
274
*/
268
275
protected $ timezone ;
269
276
277
+ /**
278
+ * @var ResolverInterface
279
+ */
280
+ private $ localeResolver ;
281
+
270
282
/**
271
283
* @param \Magento\Framework\Model\Context $context
272
284
* @param \Magento\Framework\Registry $registry
@@ -295,6 +307,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
295
307
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
296
308
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
297
309
* @param array $data
310
+ * @param ResolverInterface $localeResolver
298
311
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
299
312
*/
300
313
public function __construct (
@@ -324,7 +337,8 @@ public function __construct(
324
337
\Magento \Catalog \Model \ResourceModel \Product \CollectionFactory $ productListFactory ,
325
338
\Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
326
339
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
327
- array $ data = []
340
+ array $ data = [],
341
+ ResolverInterface $ localeResolver = null
328
342
) {
329
343
$ this ->_storeManager = $ storeManager ;
330
344
$ this ->_orderConfig = $ orderConfig ;
@@ -346,6 +360,8 @@ public function __construct(
346
360
$ this ->_trackCollectionFactory = $ trackCollectionFactory ;
347
361
$ this ->salesOrderCollectionFactory = $ salesOrderCollectionFactory ;
348
362
$ this ->priceCurrency = $ priceCurrency ;
363
+ $ this ->localeResolver = $ localeResolver ?: ObjectManager::getInstance ()->get (ResolverInterface::class);
364
+
349
365
parent ::__construct (
350
366
$ context ,
351
367
$ registry ,
@@ -1830,7 +1846,7 @@ public function getCreatedAtFormatted($format)
1830
1846
new \DateTime ($ this ->getCreatedAt ()),
1831
1847
$ format ,
1832
1848
$ format ,
1833
- null ,
1849
+ $ this -> localeResolver -> getDefaultLocale () ,
1834
1850
$ this ->timezone ->getConfigTimezone ('store ' , $ this ->getStore ())
1835
1851
);
1836
1852
}
0 commit comments