Backend\Modules\Groups\Actions\Delete::execute PHP Method

execute() public method

Execute the action
public execute ( )
    public function execute()
    {
        $this->id = $this->getParameter('id', 'int');
        // group exists and id is not null?
        if ($this->id !== null && BackendGroupsModel::exists($this->id)) {
            parent::execute();
            // get record
            $this->record = BackendGroupsModel::get($this->id);
            // delete group
            BackendGroupsModel::delete($this->id);
            // trigger event
            BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
            // item was deleted, so redirect
            $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['name']));
        } else {
            // no item found, redirect to the overview with an error
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
        }
    }
Delete