Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Delete.php
Go to the documentation of this file.
1 <?php
8 
11 
13 {
19  public function execute()
20  {
21  $id = $this->getRequest()->getParam('id');
23  $resultRedirect = $this->resultRedirectFactory->create();
24  if ($id) {
25  try {
26  $this->groupRepository->deleteById($id);
27  $this->messageManager->addSuccess(__('You deleted the customer group.'));
28  } catch (NoSuchEntityException $e) {
29  $this->messageManager->addError(__('The customer group no longer exists.'));
30  return $resultRedirect->setPath('customer/*/');
31  } catch (\Exception $e) {
32  $this->messageManager->addError($e->getMessage());
33  return $resultRedirect->setPath('customer/group/edit', ['id' => $id]);
34  }
35  }
36  return $resultRedirect->setPath('customer/group');
37  }
38 }
$id
Definition: fieldset.phtml:14
__()
Definition: __.php:13