public static function getSiteRolesForSite($nb_site) : CNabuSiteRoleList
    {
        if (is_numeric($nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID))) {
            $retval = CNabuSiteRole::buildObjectListFromSQL(
                'nb_role_id',
                'select * '
                . 'from nb_site_role '
               . 'where nb_site_id=%site_id$d',
                array(
                    'site_id' => $nb_site_id
                )
            );
            if ($nb_site instanceof CNabuSite) {
                $retval->iterate(function($key, CNabuSiteRole $nb_site_role) use ($nb_site) {
                    $nb_site_role->setSite($nb_site);
                    return true;
                });
            }
        } else {
            $retval = new CNabuSiteRoleList();
        }

        return $retval;
    }
public static function getSiteRolesForSite($nb_site) : CNabuSiteRoleList
    {
        if (is_numeric($nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID))) {
            $retval = CNabuSiteRole::buildObjectListFromSQL(
                'nb_role_id',
                'select * '
                . 'from nb_site_role '
               . 'where nb_site_id=%site_id$d',
                array(
                    'site_id' => $nb_site_id
                )
            );
            if ($nb_site instanceof CNabuSite) {
                $retval->iterate(function($key, CNabuSiteRole $nb_site_role) use ($nb_site) {
                    $nb_site_role->setSite($nb_site);
                    return true;
                });
            }
        } else {
            $retval = new CNabuSiteRoleList();
        }

        return $retval;
    }
public static function getSiteRolesForSite ( $ nb_site ) : CNabuSiteRoleList { if ( is_numeric ( $ nb_site_id = nb_getMixedValue ( $ nb_site , NABU_SITE_FIELD_ID ) ) ) { $ retval = CNabuSiteRole :: buildObjectListFromSQL ( 'nb_role_id' , 'select * ' . 'from nb_site_role ' . 'where nb_site_id=%site_id$d' , array ( 'site_id' => $ nb_site_id ) ) ; if ( $ nb_site instanceof CNabuSite ) { $ retval -> iterate ( function ( $ key , CNabuSiteRole $ nb_site_role ) use ( $ nb_site ) { $ nb_site_role -> setSite ( $ nb_site ) ; return true ; } ) ; } } else { $ retval = new CNabuSiteRoleList ( ) ; } return $ retval ; }
Get the list of all Roles assigned to a Site.
@param mixed $nb_site A CNabuDataObject containing a field named nb_site_id or a valid Site Id.
@return CNabuSiteRoleList Returns a list with all Site Role instances found.
Get the list of all Roles assigned to a Site .