Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magento 2.3 compatibility #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Controller/Adminhtml/Region/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ public function execute()
$model->load($region_id);
$region_name = $model->getDefaultName();
$model->delete();
$this->messageManager->addSuccess(__('The '.$region_name.' Region has been deleted.'));
$this->messageManager->addSuccessMessage(__('The '.$region_name.' Region has been deleted.'));
return $resultRedirect->setPath('*/*/');
} catch (\Exception $e) {
// display error message
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
// go back to edit form
return $resultRedirect->setPath('*/*/edit', ['region_id' => $region_id]);
}
}
// display error message
$this->messageManager->addError(__('Region to delete was not found.'));
$this->messageManager->addErrorMessage(__('Region to delete was not found.'));
// go to grid
return $resultRedirect->setPath('*/*/');
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Region/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function execute()
if ($id && $id > 0) {
$model->load($id);
if (!$model->getRegionId()) {
$this->messageManager->addError(__('This region no longer exists.'));
$this->messageManager->addErrorMessage(__('This region no longer exists.'));
/** \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('*/*/');
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Region/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function execute()
$page->delete();
}

$this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $collectionSize));
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
Expand Down
8 changes: 4 additions & 4 deletions Controller/Adminhtml/Region/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ public function execute()
/** @var \PHPCuong\Region\Model\Region $model */
$model = $this->_objectManager->create('PHPCuong\Region\Model\Region')->load($id);
if (!$model->getRegionId() && $id) {
$this->messageManager->addError(__('This region no longer exists.'));
$this->messageManager->addErrorMessage(__('This region no longer exists.'));
return $resultRedirect->setPath('*/*/');
}

$model->setData($data);

try {
$model->save();
$this->messageManager->addSuccess(__('You saved the region.'));
$this->messageManager->addSuccessMessage(__('You saved the region.'));

if ($this->getRequest()->getParam('back')) {
return $resultRedirect->setPath('*/*/edit', ['region_id' => $model->getRegionId()]);
}
return $resultRedirect->setPath('*/*/');
} catch (LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('Something went wrong while saving the region.'));
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the region.'));
}

$this->_getSession()->setFormData($data);
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
"Manage regions in magento2 addresses"
],
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6|~7.1.0",
"magento/module-backend": "100.0.*|100.1.*|100.2.*",
"magento/framework": "100.0.*|100.1.*|101.0.*"
"magento/module-backend": "100.0.*|100.1.*|100.2.*|^101.0",
"magento/framework": "100.0.*|100.1.*|101.0.*|^102.0"
},
"type": "magento2-module",
"version": "2.2.1",
"version": "2.3.0",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down