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

getGroup() public static method

Get information about a profile group.
public static getGroup ( integer $id ) : array
$id integer Id of the group.
return array
    public static function getGroup($id)
    {
        return (array) BackendModel::getContainer()->get('database')->getRecord('SELECT pg.id, pg.name
             FROM profiles_groups AS pg
             WHERE pg.id = ?', (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::existsGroup($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get group
         $group = BackendProfilesModel::getGroup($this->id);
         // delete group
         BackendProfilesModel::deleteGroup($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete_group', array('id' => $this->id));
         // group was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Groups') . '&report=deleted&var=' . rawurlencode($group['name']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Profiles\Engine\Model::getGroup