6 use Drupal\user\Entity\User;
8 class User8 extends UserVersion {
13 public function create($properties) {
14 $account = entity_create('user', $properties);
16 return new UserSingle8($account);
20 * Attempt to load a user account.
23 * @return \Drupal\user\Entity\User;
25 public function load_by_uid($uid) {
26 return User::load($uid);
32 public function getCurrentUserAsAccount() {
33 return \Drupal::currentUser()->getAccount();
37 * Set the current user in Drupal.
39 * @param \Drupal\Core\Session\AccountInterface $account
41 public function setCurrentUser($account) {
42 // Some parts of Drupal still rely on a global user object.
43 // @todo remove once https://www.drupal.org/node/2163205 is in.
46 \Drupal::currentUser()->setAccount($account);