/** * @param user User * @param $token Token * @return UserDto */ public function mapUserToDto(User $user, $token = null) { $userDto = new UserDto(); $userDto->setId($user->getId()); $userDto->setUserName($user->getUsername()); $userDto->setEmail($user->getEmail()); $userDto->setFirstName($user->getFirstName()); $userDto->setLastName($user->getLastName()); $userDto->setPicture($user->getPicture()); $userDto->setFile($user->getFile()); $userDto->setDisplay($user->getDisplay()); $userDto->setRole($this->roleMapper->mapUserRoleToDto($user->getRole())); $userDto->setToken($token); return $userDto; }