public static function existsCategory($id) { return (bool) BackendModel::getContainer()->get('database')->getVar('SELECT 1 FROM faq_categories AS i WHERE i.id = ? AND i.language = ? LIMIT 1', array((int) $id, BL::getWorkingLanguage())); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist? if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) { parent::execute(); $this->getData(); $this->loadForm(); $this->validateForm(); $this->parse(); $this->display(); } else { $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing'); } }