Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Unassign.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class Unassign extends \Magento\Sales\Controller\Adminhtml\Order\Status implements HttpPostActionInterface
12 {
16  public function execute()
17  {
18  $state = $this->getRequest()->getParam('state');
19  $status = $this->_initStatus();
20  if ($status) {
21  try {
22  $status->unassignState($state);
23  $this->messageManager->addSuccessMessage(__('You have unassigned the order status.'));
24  } catch (\Magento\Framework\Exception\LocalizedException $e) {
25  $this->messageManager->addErrorMessage($e->getMessage());
26  } catch (\Exception $e) {
27  $this->messageManager->addExceptionMessage(
28  $e,
29  __('Something went wrong while unassigning the order.')
30  );
31  }
32  } else {
33  $this->messageManager->addErrorMessage(__('We can\'t find this order status.'));
34  }
36  $resultRedirect = $this->resultRedirectFactory->create();
37  return $resultRedirect->setPath('sales/*/');
38  }
39 }
__()
Definition: __.php:13
$status
Definition: order_status.php:8