/** * @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); }