diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index ec98e90..d4187c9 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -155,22 +155,9 @@ public function getRoles($exclude_locked_roles = FALSE) { } } - // Optimize for the case where the field object has not been initialized - // yet, directly access the values. - if (!isset($this->fields['roles'])) { - if (isset($this->values['roles'][LanguageInterface::LANGCODE_DEFAULT][0])) { - foreach ($this->values['roles'][LanguageInterface::LANGCODE_DEFAULT] as $values) { - if (isset($values['target_id'])) { - $roles[] = $values['target_id']; - } - } - } - } - else { - foreach ($this->get('roles') as $role) { - if ($role->target_id) { - $roles[] = $role->target_id; - } + foreach ($this->get('roles') as $role) { + if ($role->target_id) { + $roles[] = $role->target_id; } }