5
5
*/
6
6
namespace Magento \Backend \Helper \Dashboard ;
7
7
8
+ use Magento \Framework \App \ObjectManager ;
9
+
8
10
/**
9
11
* Adminhtml dashboard helper for orders
10
12
*/
@@ -23,15 +25,12 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
23
25
/**
24
26
* @param \Magento\Framework\App\Helper\Context $context
25
27
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
26
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
27
28
*/
28
29
public function __construct (
29
30
\Magento \Framework \App \Helper \Context $ context ,
30
- \Magento \Reports \Model \ResourceModel \Order \Collection $ orderCollection ,
31
- \Magento \Store \Model \StoreManagerInterface $ storeManager
31
+ \Magento \Reports \Model \ResourceModel \Order \Collection $ orderCollection
32
32
) {
33
33
$ this ->_orderCollection = $ orderCollection ;
34
- $ this ->_storeManager = $ storeManager ;
35
34
parent ::__construct (
36
35
$ context
37
36
);
@@ -49,17 +48,31 @@ protected function _initCollection()
49
48
if ($ this ->getParam ('store ' )) {
50
49
$ this ->_collection ->addFieldToFilter ('store_id ' , $ this ->getParam ('store ' ));
51
50
} elseif ($ this ->getParam ('website ' )) {
52
- $ storeIds = $ this ->_storeManager ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
51
+ $ storeIds = $ this ->getStoreManager () ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
53
52
$ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
54
53
} elseif ($ this ->getParam ('group ' )) {
55
- $ storeIds = $ this ->_storeManager ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
54
+ $ storeIds = $ this ->getStoreManager () ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
56
55
$ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
57
56
} elseif (!$ this ->_collection ->isLive ()) {
58
57
$ this ->_collection ->addFieldToFilter (
59
58
'store_id ' ,
60
- ['eq ' => $ this ->_storeManager ->getStore (\Magento \Store \Model \Store::ADMIN_CODE )->getId ()]
59
+ ['eq ' => $ this ->getStoreManager () ->getStore (\Magento \Store \Model \Store::ADMIN_CODE )->getId ()]
61
60
);
62
61
}
63
62
$ this ->_collection ->load ();
64
63
}
64
+
65
+ /**
66
+ * Get Store Manager
67
+ *
68
+ * @return \Magento\Store\Model\StoreManagerInterface
69
+ */
70
+ public function getStoreManager ()
71
+ {
72
+ if (!$ this ->_storeManager ) {
73
+ $ this ->_storeManager = ObjectManager::getInstance ()->get ('Magento\Store\Model\StoreManager ' );
74
+ }
75
+
76
+ return $ this ->_storeManager ;
77
+ }
65
78
}
0 commit comments