Backend\Modules\Faq\Engine\Model::existsCategory PHP Method

existsCategory() public static method

Does the category exist?
public static existsCategory ( integer $id ) : boolean
$id integer
return boolean
    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()));
    }

Usage Example

Example #1
0
 /**
  * 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');
     }
 }
All Usage Examples Of Backend\Modules\Faq\Engine\Model::existsCategory