Beispiel #1
0
 /**
  * @param UserInterface $user
  * @return UserDTO
  */
 public static function withEntity(UserInterface $user)
 {
     $dto = new UserDTO();
     $dto->setId($user->getId());
     $dto->setEmail($user->getEmail());
     $dto->setApiKey($user->getApiKey());
     return $dto;
 }
 /**
  * @param $id
  * @return UserDTO
  * @throws UserNotFoundException
  */
 public function getUserById($id)
 {
     $user = $this->userRepository->find($id);
     if ($user === null) {
         throw new UserNotFoundException();
     }
     return UserDTO::withEntity($user);
 }