protected function CustomerProfile::loadUser in Commerce Core 8.2
Loads a user entity for the given user ID.
Falls back to the anonymous user if the user ID is empty or unknown.
Parameters
string $uid: The user ID.
Return value
\Drupal\user\UserInterface The user entity.
2 calls to CustomerProfile::loadUser()
- CustomerProfile::buildInlineForm in modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php  - Builds the inline form.
 - CustomerProfile::submitInlineForm in modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php  - Submits the inline form.
 
File
- modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php, line 376  
Class
- CustomerProfile
 - Provides an inline form for managing a customer profile.
 
Namespace
Drupal\commerce_order\Plugin\Commerce\InlineFormCode
protected function loadUser($uid) {
  $customer = User::getAnonymousUser();
  if (!empty($uid)) {
    $user_storage = $this->entityTypeManager
      ->getStorage('user');
    /** @var \Drupal\user\UserInterface $user */
    $user = $user_storage
      ->load($uid);
    if ($user) {
      $customer = $user;
    }
  }
  return $customer;
}