function User::__get

Implements the magic method for getting object properties.

@todo A lot of code still uses non-fields (e.g. $entity->content in view builders) by reference. Clean that up.

Overrides ContentEntityBase::__get

File

core/modules/user/src/Entity/User.php, line 620

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

public function &__get($name) : mixed {
  if ($name == 'password') {
    @trigger_error("Getting the password property is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/3569185", E_USER_DEPRECATED);
  }
  return parent::__get($name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.