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

existsProfileGroup() public static method

Check if a profile is in a group.
public static existsProfileGroup ( integer $id ) : boolean
$id integer Membership id.
return boolean
    public static function existsProfileGroup($id)
    {
        return (bool) BackendModel::getContainer()->get('database')->getVar('SELECT 1
             FROM profiles_groups_rights AS gr
             WHERE gr.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 exist
     if ($this->id !== null && BackendProfilesModel::existsProfileGroup($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get profile group
         $profileGroup = BackendProfilesModel::getProfileGroup($this->id);
         // delete profile group
         BackendProfilesModel::deleteProfileGroup($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_profile_delete_from_group', array('id' => $this->id));
         // profile group was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $profileGroup['profile_id'] . '&report=membership-deleted#tabGroups');
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Profiles\Engine\Model::existsProfileGroup