Skip to content

Commit 4697d93

Browse files
Fixed the usage of deprecated methods of Messagemanager
1 parent ff2fa21 commit 4697d93

23 files changed

+58
-58
lines changed

app/code/Magento/Customer/Controller/Account/Confirm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function execute()
168168
$metadata->setPath('/');
169169
$this->getCookieManager()->deleteCookie('mage-cache-sessid', $metadata);
170170
}
171-
$this->messageManager->addSuccess($this->getSuccessMessage());
171+
$this->messageManager->addSuccessMessage($this->getSuccessMessage());
172172
$resultRedirect->setUrl($this->getSuccessRedirect());
173173
return $resultRedirect;
174174
} catch (StateException $e) {

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function execute()
367367
if ($confirmationStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED) {
368368
$email = $this->customerUrl->getEmailConfirmationUrl($customer->getEmail());
369369
// @codingStandardsIgnoreStart
370-
$this->messageManager->addSuccess(
370+
$this->messageManager->addSuccessMessage(
371371
__(
372372
'You must confirm your account. Please check your email for the confirmation link or <a href="%1">click here</a> for a new link.',
373373
$email
@@ -378,7 +378,7 @@ public function execute()
378378
$resultRedirect->setUrl($this->_redirect->success($url));
379379
} else {
380380
$this->session->setCustomerDataAsLoggedIn($customer);
381-
$this->messageManager->addSuccess($this->getSuccessMessage());
381+
$this->messageManager->addSuccessMessage($this->getSuccessMessage());
382382
$requestedRedirect = $this->accountRedirect->getRedirectCookie();
383383
if (!$this->scopeConfig->getValue('customer/startup/redirect_dashboard') && $requestedRedirect) {
384384
$resultRedirect->setUrl($this->_redirect->success($requestedRedirect));
@@ -402,14 +402,14 @@ public function execute()
402402
$url
403403
);
404404
// @codingStandardsIgnoreEnd
405-
$this->messageManager->addError($message);
405+
$this->messageManager->addErrorMessage($message);
406406
} catch (InputException $e) {
407-
$this->messageManager->addError($this->escaper->escapeHtml($e->getMessage()));
407+
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage()));
408408
foreach ($e->getErrors() as $error) {
409-
$this->messageManager->addError($this->escaper->escapeHtml($error->getMessage()));
409+
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($error->getMessage()));
410410
}
411411
} catch (LocalizedException $e) {
412-
$this->messageManager->addError($this->escaper->escapeHtml($e->getMessage()));
412+
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage()));
413413
} catch (\Exception $e) {
414414
$this->messageManager->addException($e, __('We can\'t save the customer.'));
415415
}

app/code/Magento/Customer/Controller/Account/EditPost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function execute()
216216
$isPasswordChanged
217217
);
218218
$this->dispatchSuccessEvent($customerCandidateDataObject);
219-
$this->messageManager->addSuccess(__('You saved the account information.'));
219+
$this->messageManager->addSuccessMessage(__('You saved the account information.'));
220220
return $resultRedirect->setPath('customer/account');
221221
} catch (InvalidEmailOrPasswordException $e) {
222222
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage()));
@@ -227,15 +227,15 @@ public function execute()
227227
);
228228
$this->session->logout();
229229
$this->session->start();
230-
$this->messageManager->addError($message);
230+
$this->messageManager->addErrorMessage($message);
231231
return $resultRedirect->setPath('customer/account/login');
232232
} catch (InputException $e) {
233233
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage()));
234234
foreach ($e->getErrors() as $error) {
235235
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($error->getMessage()));
236236
}
237237
} catch (\Magento\Framework\Exception\LocalizedException $e) {
238-
$this->messageManager->addError($e->getMessage());
238+
$this->messageManager->addErrorMessage($e->getMessage());
239239
} catch (\Exception $e) {
240240
$this->messageManager->addException($e, __('We can\'t save the customer.'));
241241
}

app/code/Magento/Customer/Controller/Account/LoginPost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,17 @@ public function execute()
217217
$message = $e->getMessage();
218218
} catch (\Exception $e) {
219219
// PA DSS violation: throwing or logging an exception here can disclose customer password
220-
$this->messageManager->addError(
220+
$this->messageManager->addErrorMessage(
221221
__('An unspecified error occurred. Please contact us for assistance.')
222222
);
223223
} finally {
224224
if (isset($message)) {
225-
$this->messageManager->addError($message);
225+
$this->messageManager->addErrorMessage($message);
226226
$this->session->setUsername($login['username']);
227227
}
228228
}
229229
} else {
230-
$this->messageManager->addError(__('A login and a password are required.'));
230+
$this->messageManager->addErrorMessage(__('A login and a password are required.'));
231231
}
232232
}
233233

app/code/Magento/Customer/Controller/Account/ResetPasswordPost.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ public function execute()
7373
$passwordConfirmation = (string)$this->getRequest()->getPost('password_confirmation');
7474

7575
if ($password !== $passwordConfirmation) {
76-
$this->messageManager->addError(__("New Password and Confirm New Password values didn't match."));
76+
$this->messageManager->addErrorMessage(__("New Password and Confirm New Password values didn't match."));
7777
$resultRedirect->setPath('*/*/createPassword', ['token' => $resetPasswordToken]);
7878

7979
return $resultRedirect;
8080
}
8181
if (iconv_strlen($password) <= 0) {
82-
$this->messageManager->addError(__('Please enter a new password.'));
82+
$this->messageManager->addErrorMessage(__('Please enter a new password.'));
8383
$resultRedirect->setPath('*/*/createPassword', ['token' => $resetPasswordToken]);
8484

8585
return $resultRedirect;
@@ -92,17 +92,17 @@ public function execute()
9292
$password
9393
);
9494
$this->session->unsRpToken();
95-
$this->messageManager->addSuccess(__('You updated your password.'));
95+
$this->messageManager->addSuccessMessage(__('You updated your password.'));
9696
$resultRedirect->setPath('*/*/login');
9797

9898
return $resultRedirect;
9999
} catch (InputException $e) {
100-
$this->messageManager->addError($e->getMessage());
100+
$this->messageManager->addErrorMessage($e->getMessage());
101101
foreach ($e->getErrors() as $error) {
102-
$this->messageManager->addError($error->getMessage());
102+
$this->messageManager->addErrorMessage($error->getMessage());
103103
}
104104
} catch (\Exception $exception) {
105-
$this->messageManager->addError(__('Something went wrong while saving the new password.'));
105+
$this->messageManager->addErrorMessage(__('Something went wrong while saving the new password.'));
106106
}
107107
$resultRedirect->setPath('*/*/createPassword', ['token' => $resetPasswordToken]);
108108

app/code/Magento/Customer/Controller/Address/Delete.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public function execute()
2727
$address = $this->_addressRepository->getById($addressId);
2828
if ($address->getCustomerId() === $this->_getSession()->getCustomerId()) {
2929
$this->_addressRepository->deleteById($addressId);
30-
$this->messageManager->addSuccess(__('You deleted the address.'));
30+
$this->messageManager->addSuccessMessage(__('You deleted the address.'));
3131
} else {
32-
$this->messageManager->addError(__('We can\'t delete the address right now.'));
32+
$this->messageManager->addErrorMessage(__('We can\'t delete the address right now.'));
3333
}
3434
} catch (\Exception $other) {
3535
$this->messageManager->addException($other, __('We can\'t delete the address right now.'));

app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ public function execute()
139139
if ($customerId = $this->getRequest()->getParam('customer_id')) {
140140
try {
141141
$this->tokenService->revokeCustomerAccessToken($customerId);
142-
$this->messageManager->addSuccess(__('You have revoked the customer\'s tokens.'));
142+
$this->messageManager->addSuccessMessage(__('You have revoked the customer\'s tokens.'));
143143
$resultRedirect->setPath('customer/index/edit', ['id' => $customerId, '_current' => true]);
144144
} catch (\Exception $e) {
145-
$this->messageManager->addError($e->getMessage());
145+
$this->messageManager->addErrorMessage($e->getMessage());
146146
$resultRedirect->setPath('customer/index/edit', ['id' => $customerId, '_current' => true]);
147147
}
148148
} else {
149-
$this->messageManager->addError(__('We can\'t find a customer to revoke.'));
149+
$this->messageManager->addErrorMessage(__('We can\'t find a customer to revoke.'));
150150
$resultRedirect->setPath('customer/index/index');
151151
}
152152
return $resultRedirect;

app/code/Magento/Customer/Controller/Adminhtml/Group/Delete.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function execute()
2424
if ($id) {
2525
try {
2626
$this->groupRepository->deleteById($id);
27-
$this->messageManager->addSuccess(__('You deleted the customer group.'));
27+
$this->messageManager->addSuccessMessage(__('You deleted the customer group.'));
2828
} catch (NoSuchEntityException $e) {
29-
$this->messageManager->addError(__('The customer group no longer exists.'));
29+
$this->messageManager->addErrorMessage(__('The customer group no longer exists.'));
3030
return $resultRedirect->setPath('customer/*/');
3131
} catch (\Exception $e) {
32-
$this->messageManager->addError($e->getMessage());
32+
$this->messageManager->addErrorMessage($e->getMessage());
3333
return $resultRedirect->setPath('customer/group/edit', ['id' => $id]);
3434
}
3535
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public function execute()
9393

9494
$this->groupRepository->save($customerGroup);
9595

96-
$this->messageManager->addSuccess(__('You saved the customer group.'));
96+
$this->messageManager->addSuccessMessage(__('You saved the customer group.'));
9797
$resultRedirect->setPath('customer/group');
9898
} catch (\Exception $e) {
99-
$this->messageManager->addError($e->getMessage());
99+
$this->messageManager->addErrorMessage($e->getMessage());
100100
if ($customerGroup != null) {
101101
$this->storeCustomerGroupDataToSession(
102102
$this->dataObjectProcessor->buildOutputDataArray(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function execute()
6464
$collection = $this->filter->getCollection($this->collectionFactory->create());
6565
return $this->massAction($collection);
6666
} catch (\Exception $e) {
67-
$this->messageManager->addError($e->getMessage());
67+
$this->messageManager->addErrorMessage($e->getMessage());
6868
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6969
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
7070
return $resultRedirect->setPath($this->redirectUrl);

0 commit comments

Comments
 (0)