public function getRoles()
    {
        $roles = $this->roles;

        foreach ($this->getGroups() as $group) {
            $roles = array_merge($roles, $group->getRoles());
        }

        $newRoles = [];

        if ($this->getActiveRole()) {
            $newRoles = $this->getActiveRole()->getRoles();
        }

        $finalRoles = array_merge($roles, $newRoles);

        // we need to make sure to have at least one role
        $finalRoles[] = static::ROLE_DEFAULT;

        return array_unique($finalRoles);
    }
public function getRoles()
    {
        $roles = $this->roles;

        foreach ($this->getGroups() as $group) {
            $roles = array_merge($roles, $group->getRoles());
        }

        $newRoles = [];

        if ($this->getActiveRole()) {
            $newRoles = $this->getActiveRole()->getRoles();
        }

        $finalRoles = array_merge($roles, $newRoles);

        // we need to make sure to have at least one role
        $finalRoles[] = static::ROLE_DEFAULT;

        return array_unique($finalRoles);
    }
public function getRoles ( ) { $ roles = $ this -> roles ; foreach ( $ this -> getGroups ( ) as $ group ) { $ roles = array_merge ( $ roles , $ group -> getRoles ( ) ) ; } $ newRoles = [ ] ; if ( $ this -> getActiveRole ( ) ) { $ newRoles = $ this -> getActiveRole ( ) -> getRoles ( ) ; } $ finalRoles = array_merge ( $ roles , $ newRoles ) ; // we need to make sure to have at least one role $ finalRoles [ ] = static :: ROLE_DEFAULT ; return array_unique ( $ finalRoles ) ; }
Returns the user roles

@return array The roles
Returns the user roles