public function UserBCDecorator::__get

Implements the magic method for getting object properties.

Directly accesses the plain field values, as done in Drupal 7.

Overrides EntityBCDecorator::__get

File

drupal/core/modules/user/lib/Drupal/user/UserBCDecorator.php, line 20
Contains \Drupal\user\UserBCDecorator.

Class

UserBCDecorator
Defines the user specific entity BC decorator.

Namespace

Drupal\user

Code

public function &__get($name) {

  // Special handling for roles, as the return value is expected to be an
  // array.
  if ($name == 'roles') {
    $roles = $this->decorated
      ->getRoles();
    return $roles;
  }
  return parent::__get($name);
}