Back to UserGroupsHelper class

Method load

public mixed
load
(mixed $id)
Load a group from database.
Parameters
  • int $id Group identifier
Returns
  • mixed
Since
  • 3.6.3

Method load - Source code

/**
 * Load a group from database.
 *
 * @param   integer  $id  Group identifier
 *
 * @return  mixed
 *
 * @since   3.6.3
 */
public function load($id)
{
    // Cast as integer until method is typehinted.
    $id = (int) $id;
    $db = Factory::getDbo();
    $query = $db->getQuery(true)->select('*')->from($db->quoteName('#__usergroups'))->where($db->quoteName('id') . ' = :id')->bind(':id', $id, ParameterType::INTEGER);
    $db->setQuery($query);
    $group = $db->loadObject();
    if (!$group) {
        return false;
    }
    return $this->populateGroupData($group);
}