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

execute() public method

Execute the action
public execute ( )
    public function execute()
    {
        // get parameters
        $this->id = $this->getParameter('id', 'int');
        // does the item exist
        if ($this->id !== null && BackendLocationModel::exists($this->id)) {
            parent::execute();
            // get all data for the item we want to edit
            $this->record = (array) BackendLocationModel::get($this->id);
            // delete item
            BackendLocationModel::delete($this->id);
            // trigger event
            BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
            // user was deleted, so redirect
            $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['title']));
        } else {
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
        }
    }
Delete