13
13
* @api
14
14
* @since 100.0.2
15
15
*/
16
- class Order extends \ Magento \ Backend \ Helper \ Dashboard \ AbstractDashboard
16
+ class Order extends AbstractDashboard
17
17
{
18
18
/**
19
19
* @var \Magento\Reports\Model\ResourceModel\Order\Collection
@@ -29,32 +29,25 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
29
29
/**
30
30
* @param \Magento\Framework\App\Helper\Context $context
31
31
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
32
+ * @param \Magento\Store\Model\StoreManagerInterface $storeManager
32
33
*/
33
34
public function __construct (
34
35
\Magento \Framework \App \Helper \Context $ context ,
35
- \Magento \Reports \Model \ResourceModel \Order \Collection $ orderCollection
36
+ \Magento \Reports \Model \ResourceModel \Order \Collection $ orderCollection ,
37
+ \Magento \Store \Model \StoreManagerInterface $ storeManager = null
36
38
) {
37
39
$ this ->_orderCollection = $ orderCollection ;
38
- parent :: __construct ( $ context );
39
- }
40
+ $ this -> _storeManager = $ storeManager ?: ObjectManager:: getInstance ()
41
+ -> get (\ Magento \ Store \ Model \StoreManagerInterface::class);
40
42
41
- /**
42
- * The getter function to get the new StoreManager dependency
43
- *
44
- * @return \Magento\Store\Model\StoreManagerInterface
45
- *
46
- * @deprecated 100.1.0
47
- */
48
- private function getStoreManager ()
49
- {
50
- if ($ this ->_storeManager === null ) {
51
- $ this ->_storeManager = ObjectManager::getInstance ()->get (\Magento \Store \Model \StoreManagerInterface::class);
52
- }
53
- return $ this ->_storeManager ;
43
+ parent ::__construct ($ context );
54
44
}
55
45
56
46
/**
57
47
* @return void
48
+ *
49
+ * @throws \Magento\Framework\Exception\LocalizedException
50
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
58
51
*/
59
52
protected function _initCollection ()
60
53
{
@@ -65,15 +58,15 @@ protected function _initCollection()
65
58
if ($ this ->getParam ('store ' )) {
66
59
$ this ->_collection ->addFieldToFilter ('store_id ' , $ this ->getParam ('store ' ));
67
60
} elseif ($ this ->getParam ('website ' )) {
68
- $ storeIds = $ this ->getStoreManager () ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
61
+ $ storeIds = $ this ->_storeManager ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
69
62
$ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
70
63
} elseif ($ this ->getParam ('group ' )) {
71
- $ storeIds = $ this ->getStoreManager () ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
64
+ $ storeIds = $ this ->_storeManager ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
72
65
$ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
73
66
} elseif (!$ this ->_collection ->isLive ()) {
74
67
$ this ->_collection ->addFieldToFilter (
75
68
'store_id ' ,
76
- ['eq ' => $ this ->getStoreManager () ->getStore (\Magento \Store \Model \Store::ADMIN_CODE )->getId ()]
69
+ ['eq ' => $ this ->_storeManager ->getStore (\Magento \Store \Model \Store::ADMIN_CODE )->getId ()]
77
70
);
78
71
}
79
72
$ this ->_collection ->load ();
0 commit comments