Backend\Modules\Profiles\Engine\Model::existsGroup PHP Method

existsGroup() public static method

Check if a group exists.
public static existsGroup ( integer $id ) : boolean
$id integer Group id.
return boolean
    public static function existsGroup($id)
    {
        return (bool) BackendModel::getContainer()->get('database')->getVar('SELECT 1
             FROM profiles_groups AS pg
             WHERE pg.id = ?
             LIMIT 1', (int) $id);
    }

Usage Example

Example #1
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendProfilesModel::existsGroup($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Profiles\Engine\Model::existsGroup