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