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); }
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; }
/** * @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']); }
/** * @param UserDto $user * @return void */ public function SetReservationUser(UserDto $user) { $this->Set('ReservationUserName', $user->FullName()); $this->Set('UserId', $user->Id()); }
public function __construct() { parent::__construct(0, null, null, null, null, null); }
/** * @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); }
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)); }
/** * @return string */ function Body() { $this->Set('UserFullName', $this->deletedUser->FullName()); $this->Set('AdminFullName', $this->to->FullName()); return $this->FetchTemplate('AccountDeleted.tpl'); }
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;