Skip to content

Commit 45797b9

Browse files
author
Cari Spruiell
committed
MAGETWO-50789: Fix incorrect getter methods
- correct method implementations
1 parent 1aabd4e commit 45797b9

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ public function __construct(
3535
}
3636

3737
/**
38-
* @return \Magento\SalesRule\Model\RuleFactory
38+
* The getter function to get the new StoreManager dependency
39+
*
40+
* @return \Magento\Store\Model\StoreManagerInterface
41+
*
3942
* @deprecated
4043
*/
41-
public function getStoreManager()
44+
private function getStoreManager()
4245
{
43-
if ($this->_storeManager instanceof \Magento\Store\Model\StoreManagerInterface) {
44-
$this->_storeManager = ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
46+
if ($this->_storeManager === null) {
47+
$this->_storeManager = ObjectManager::getInstance()->get('Magento\Store\Model\StoreManagerInterface');
4548
}
49+
return $this->_storeManager;
4650
}
4751

4852
/**

app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,18 @@ public function __construct(
6565
}
6666

6767
/**
68+
* The getter function to get the new RuleFactory dependency
69+
*
6870
* @return \Magento\SalesRule\Model\RuleFactory
71+
*
6972
* @deprecated
7073
*/
71-
public function getRuleFactory()
74+
private function getRuleFactory()
7275
{
73-
if ($this->ruleFactory instanceof \Magento\SalesRule\Model\RuleFactory) {
74-
$this->ruleFactory = ObjectManager::getInstance()->get('\Magento\SalesRule\Model\RuleFactory');
76+
if ($this->ruleFactory === null) {
77+
$this->ruleFactory = ObjectManager::getInstance()->get('Magento\SalesRule\Model\RuleFactory');
7578
}
79+
return $this->ruleFactory;
7680
}
7781

7882
/**

app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ public function __construct(
5656
}
5757

5858
/**
59+
* The getter function to get the new RuleFactory dependency
60+
*
5961
* @return \Magento\SalesRule\Model\RuleFactory
62+
*
6063
* @deprecated
6164
*/
62-
public function getRuleFactory()
65+
private function getRuleFactory()
6366
{
64-
if ($this->ruleFactory instanceof \Magento\SalesRule\Model\RuleFactory) {
65-
$this->ruleFactory = ObjectManager::getInstance()->get('\Magento\SalesRule\Model\RuleFactory');
67+
if ($this->ruleFactory === null) {
68+
$this->ruleFactory = ObjectManager::getInstance()->get('Magento\SalesRule\Model\RuleFactory');
6669
}
70+
return $this->ruleFactory;
6771
}
6872

6973
/**

0 commit comments

Comments
 (0)