/**
  * @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;
 }
Beispiel #2
0
function bindUserEntity($userEntity)
{
    if ($userEntity != null) {
        $userDto = new UserDto();
        $userDto->setUserId($userEntity->getUserId());
        $userDto->setEmail($userEntity->getEmail());
        $userDto->setPassword($userEntity->getPassword());
        $userDto->setName($userEntity->getName());
        $userDto->setSurname($userEntity->getSurname());
        $userDto->setPhone($userEntity->getPhone());
        $userDto->setGender($userEntity->getGender());
        $userDto->setAge($userEntity->getAge());
        $userDto->setUserAllowPush($userEntity->getUserAllowPush());
        return $userDto;
    } else {
        return null;
    }
}