Checks if a comment exists
public static existsComment ( integer $id ) : integer | ||
$id | integer | The id of the item to check for existence. |
return | integer |
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendBlogModel::existsComment($this->id)) { parent::execute(); $this->getData(); $this->loadForm(); $this->validateForm(); $this->parse(); $this->display(); } else { // no item found, throw an exception, because somebody is f*****g with our URL $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }