public function getUser($userId)
{
// Check if we've already retrieved this user.
if (isset($this->userEntities[$userId])) {
return $this->userEntities[$userId];
}
$query = $this->getUserQuery($userId);
/** @var Entity\Users $userEntity */
if ($userEntity = $this->findOneWith($query)) {
$this->unsetSensitiveFields($userEntity);
}
// Remember the user
$this->userEntities[$userId] = $userEntity;
return $userEntity;
}
/** * Get a user, specified by ID, username or email address. * * @param integer|string $userId * * @return array|false */ public function getUser($userId) { if ($userEntity = $this->repository->getUser($userId)) { $userEntity->setPassword('**dontchange**'); return $userEntity->toArray(); } return false; }