function AccountProxy::loadUserEntity
Same name in other branches
- 9 core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::loadUserEntity()
- 8.9.x core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::loadUserEntity()
- 11.x core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::loadUserEntity()
Load a user entity.
The entity type manager requires additional initialization code and cache clearing after the list of modules is changed. Therefore it is necessary to retrieve it as late as possible.
Because of serialization issues it is currently not possible to inject the container into the AccountProxy. Thus it is necessary to retrieve the entity type manager statically.
Parameters
int $account_id: The id of an account to load.
Return value
\Drupal\Core\Session\AccountInterface|null An account or NULL if none is found.
See also
https://www.drupal.org/node/2430447
1 call to AccountProxy::loadUserEntity()
- AccountProxy::getAccount in core/
lib/ Drupal/ Core/ Session/ AccountProxy.php
File
-
core/
lib/ Drupal/ Core/ Session/ AccountProxy.php, line 217
Class
- AccountProxy
- A proxied implementation of AccountInterface.
Namespace
Drupal\Core\SessionCode
protected function loadUserEntity($account_id) {
return \Drupal::entityTypeManager()->getStorage('user')
->load($account_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.