1313 * @api
1414 * @since 100.0.2
1515 */
16- class Order extends \ Magento \ Backend \ Helper \ Dashboard \ AbstractDashboard
16+ class Order extends AbstractDashboard
1717{
1818 /**
1919 * @var \Magento\Reports\Model\ResourceModel\Order\Collection
@@ -29,32 +29,25 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
2929 /**
3030 * @param \Magento\Framework\App\Helper\Context $context
3131 * @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
32+ * @param \Magento\Store\Model\StoreManagerInterface $storeManager
3233 */
3334 public function __construct (
3435 \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
3638 ) {
3739 $ this ->_orderCollection = $ orderCollection ;
38- parent :: __construct ( $ context );
39- }
40+ $ this -> _storeManager = $ storeManager ?: ObjectManager:: getInstance ()
41+ -> get (\ Magento \ Store \ Model \StoreManagerInterface::class);
4042
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 );
5444 }
5545
5646 /**
5747 * @return void
48+ *
49+ * @throws \Magento\Framework\Exception\LocalizedException
50+ * @throws \Magento\Framework\Exception\NoSuchEntityException
5851 */
5952 protected function _initCollection ()
6053 {
@@ -65,15 +58,15 @@ protected function _initCollection()
6558 if ($ this ->getParam ('store ' )) {
6659 $ this ->_collection ->addFieldToFilter ('store_id ' , $ this ->getParam ('store ' ));
6760 } elseif ($ this ->getParam ('website ' )) {
68- $ storeIds = $ this ->getStoreManager () ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
61+ $ storeIds = $ this ->_storeManager ->getWebsite ($ this ->getParam ('website ' ))->getStoreIds ();
6962 $ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
7063 } elseif ($ this ->getParam ('group ' )) {
71- $ storeIds = $ this ->getStoreManager () ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
64+ $ storeIds = $ this ->_storeManager ->getGroup ($ this ->getParam ('group ' ))->getStoreIds ();
7265 $ this ->_collection ->addFieldToFilter ('store_id ' , ['in ' => implode (', ' , $ storeIds )]);
7366 } elseif (!$ this ->_collection ->isLive ()) {
7467 $ this ->_collection ->addFieldToFilter (
7568 '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 ()]
7770 );
7871 }
7972 $ this ->_collection ->load ();
0 commit comments