Skip to content

Commit 0cc7bfe

Browse files
committed
ACP2E-2791: Not able to Save Customer attribute information in Admin Edit customer section;
1 parent 195e928 commit 0cc7bfe

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
use Magento\Framework\View\Result\PageFactory;
4848
use Magento\Newsletter\Model\SubscriberFactory;
4949
use Magento\Newsletter\Model\SubscriptionManagerInterface;
50+
use Magento\Store\Model\StoreManagerInterface;
5051

5152
/**
5253
* Save customer action.
@@ -70,6 +71,11 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index implements HttpP
7071
*/
7172
private $addressRegistry;
7273

74+
/**
75+
* @var StoreManagerInterface
76+
*/
77+
private $storeManager;
78+
7379
/**
7480
* @var SetCustomerStore|null
7581
*/
@@ -105,8 +111,10 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index implements HttpP
105111
* @param JsonFactory $resultJsonFactory
106112
* @param SubscriptionManagerInterface $subscriptionManager
107113
* @param AddressRegistry|null $addressRegistry
114+
* @param StoreManagerInterface|null $storeManager
108115
* @param SetCustomerStore|null $customerStore
109116
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
117+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
110118
*/
111119
public function __construct(
112120
Context $context,
@@ -136,6 +144,7 @@ public function __construct(
136144
JsonFactory $resultJsonFactory,
137145
SubscriptionManagerInterface $subscriptionManager,
138146
AddressRegistry $addressRegistry = null,
147+
?StoreManagerInterface $storeManager = null,
139148
?SetCustomerStore $customerStore = null
140149
) {
141150
parent::__construct(
@@ -167,7 +176,8 @@ public function __construct(
167176
);
168177
$this->subscriptionManager = $subscriptionManager;
169178
$this->addressRegistry = $addressRegistry ?: ObjectManager::getInstance()->get(AddressRegistry::class);
170-
$this->customerStore = $customerStore ?: ObjectManager::getInstance()->get(SetCustomerStore::class);
179+
$this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class);
180+
$this->customerStore = $customerStore ?? ObjectManager::getInstance()->get(SetCustomerStore::class);
171181
}
172182

173183
/**

app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
use Magento\Framework\App\Action\HttpGetActionInterface;
1818
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1919
use Magento\Customer\Api\Data\CustomerInterface;
20+
use Magento\Framework\App\ObjectManager;
2021
use Magento\Framework\DataObjectFactory as ObjectFactory;
2122
use Magento\Framework\Message\Error;
2223
use Magento\Customer\Controller\Adminhtml\Index as CustomerAction;
24+
use Magento\Store\Model\StoreManagerInterface;
2325

2426
/**
2527
* Class for validation of customer
@@ -29,7 +31,12 @@
2931
class Validate extends CustomerAction implements HttpPostActionInterface, HttpGetActionInterface
3032
{
3133
/**
32-
* @var SetCustomerStore
34+
* @var StoreManagerInterface
35+
*/
36+
private $storeManager;
37+
38+
/**
39+
* @var SetCustomerStore|null
3340
*/
3441
private $customerStore;
3542

@@ -59,8 +66,10 @@ class Validate extends CustomerAction implements HttpPostActionInterface, HttpGe
5966
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
6067
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
6168
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
62-
* @param SetCustomerStore $customerStore
69+
* @param StoreManagerInterface|null $storeManager
70+
* @param SetCustomerStore|null $customerStore
6371
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
72+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6473
*/
6574
public function __construct(
6675
\Magento\Backend\App\Action\Context $context,
@@ -88,7 +97,8 @@ public function __construct(
8897
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
8998
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
9099
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
91-
SetCustomerStore $customerStore
100+
?StoreManagerInterface $storeManager = null,
101+
?SetCustomerStore $customerStore = null
92102
) {
93103
parent::__construct(
94104
$context,
@@ -117,7 +127,8 @@ public function __construct(
117127
$resultForwardFactory,
118128
$resultJsonFactory
119129
);
120-
$this->customerStore = $customerStore;
130+
$this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class);
131+
$this->customerStore = $customerStore ?? ObjectManager::getInstance()->get(SetCustomerStore::class);
121132
}
122133

123134
/**

0 commit comments

Comments
 (0)