예제 #1
0
 public function updateUser(UserDto $userDto)
 {
     $userRole = $this->userRoleService->getUserRoleById($userDto->getRole());
     ResultHelper::whenEmpty($userRole, AppLabelUtil::$ERROR_ROLE_NOT_FOUND, HttpStatusCode::badRequest());
     $user = $this->userMapper->mapUserDtoToUser($userDto);
     $user->setRole($userRole);
     $this->userService->updateUser($user);
 }
예제 #2
0
 public function mapUserDtoToUser(UserDto $userDto)
 {
     $user = new User();
     $user->setId($userDto->getId());
     $user->setEmail($userDto->getEmail());
     $user->setFirstName($userDto->getFirstName());
     $user->setLastName($userDto->getLastName());
     $user->setUsername($userDto->getUserName());
     $user->setPicture($userDto->getPicture());
     $user->setFile($userDto->getFile());
     $user->setDisplay($userDto->getDisplay());
     $user->setRole($userDto->getRole());
     return $user;
 }
예제 #3
0
 /**
  * @param $userName
  * @param $email
  * @param $name
  * @param $password
  *
  * @dataProvider generateUsers
  */
 public function testSerialization($userName, $email, $name, $password)
 {
     $model = new UserDto($userName, $email, $name, $password);
     $model->setPassword($password);
     $array = $model->toArray();
     $this->assertArrayHasKey('userName', $array);
     $this->assertArrayHasKey('email', $array);
     $this->assertArrayHasKey('name', $array);
     /*
      * Private properties should not be serialized
      */
     $this->assertArrayNotHasKey('password', $array);
     $this->assertEquals($userName, $array['userName']);
     $this->assertEquals($email, $array['email']);
     $this->assertEquals($name, $array['name']);
 }
예제 #4
0
 /**
  * @param UserDto $user
  * @return void
  */
 public function SetReservationUser(UserDto $user)
 {
     $this->Set('ReservationUserName', $user->FullName());
     $this->Set('UserId', $user->Id());
 }
예제 #5
0
 public function __construct()
 {
     parent::__construct(0, null, null, null, null, null);
 }
예제 #6
0
 /**
  * @param UserDto $user
  * @return void
  */
 public function SetReservationUser(UserDto $user)
 {
     $this->Set('ReservationUserName', $user->FullName());
     $this->Set('UserId', $user->Id());
     $this->Set('IsAdmin', ServiceLocator::GetServer()->GetUserSession()->IsAdmin);
     $userRepo = new UserRepository();
     $userAttributes = array();
     $loadedUser = $userRepo->LoadById($user->Id());
     $userAttributes['traininglevel'] = $loadedUser->GetAttributeValue(17);
     $userAttributes['trainingtype'] = $loadedUser->GetAttributeValue(15);
     $userAttributes['saat'] = $loadedUser->GetAttributeValue(8);
     $this->Set('UserAttributes', $userAttributes);
 }
예제 #7
0
function bindUserEntity($userEntity)
{
    if ($userEntity != null) {
        $userDto = new UserDto();
        $userDto->setUserId($userEntity->getUserId());
        $userDto->setUserEmail($userEntity->getUserEmail());
        $userDto->setUserPassword($userEntity->getUserPassword());
        $userDto->setUserName($userEntity->getUserName());
        $userDto->setUserSurname($userEntity->getUserSurname());
        $userDto->setUserNumber($userEntity->getUserNumber());
        $userDto->setUserGender($userEntity->getUserGender());
        $userDto->setUserAge($userEntity->getUserAge());
        $userDto->setUserAllowPush($userEntity->getUserAllowPush());
        return $userDto;
    } else {
        return null;
    }
}
 /**
  * @see IEmailMessage::To()
  */
 public function To()
 {
     $address = $this->adminDto->EmailAddress();
     $name = $this->adminDto->FullName();
     return array(new EmailAddress($address, $name));
 }
예제 #9
0
 /**
  * @return string
  */
 function Body()
 {
     $this->Set('UserFullName', $this->deletedUser->FullName());
     $this->Set('AdminFullName', $this->to->FullName());
     return $this->FetchTemplate('AccountDeleted.tpl');
 }
예제 #10
0
    foreach ($userListDto->getUsers() as $userDto) {
        $userEntity = bindUserDto($userDto);
        $entityManager->persist($userEntity);
        $entityManager->flush();
    }
});
$app->put('/users/:id', function ($id) use($app) {
    global $entityManager;
    $userEntity = $entityManager->find("UserEntity", $id);
    $entityManager->flush();
    $userDto = bindUserEntity($userEntity);
    $userDto->printData($app);
});
$app->post('/users', function () use($app) {
    global $entityManager;
    $userDto = new UserDto();
    $userDto->bindJson($app);
    $entityManager->persist($userEntity);
    $entityManager->flush();
    $userDto = bindUserEntity($userEntity);
    $userDto->printData($app);
});
$app->delete('/users/:id', function ($id) use($app) {
    global $entityManager;
    $userEntity = $entityManager->find("UserEntity", $id);
    $entityManager->remove($userEntity);
    $entityManager->flush();
});
/*Referances*/
$app->get('/users/:id/userdevicess', function ($id) use($app) {
    global $entityManager;