Exemplo n.º 1
0
 /**
  * @param UserEntity $user
  *
  * @return User
  */
 public static function build(UserEntity $user)
 {
     $userModel = new User();
     $userModel->setId($user->getId()->id());
     $userModel->setName($user->getName());
     $userModel->setSurname($user->getSurname());
     $userModel->setEmail($user->getEmail());
     $userModel->setUsername($user->getUsername());
     $userModel->setSalt($user->getSalt());
     $userModel->setPassword($user->getPassword());
     $userModel->setCreatedAt($user->getCreatedAt());
     $userModel->setEnabled($user->isEnabled());
     $userModel->setAccountNonExpired($user->isAccountNonExpired());
     $userModel->setAccountNonLocked($user->isAccountNonLocked());
     $userModel->setCredentialsNonExpired($user->isCredentialsNonExpired());
     $userModel->setRoles($user->getRoles()[0]);
     return $userModel;
 }
Exemplo n.º 2
0
 /**
  * @param User $user
  */
 public function update(User $user)
 {
     $this->client->put(self::API_USER . '/' . $user->getId()->id(), ['form_params' => ['name' => $user->getName(), 'surname' => $user->getSurname(), 'email' => $user->getEmail(), 'username' => $user->getUsername(), 'roles' => serialize($user->getRoles()), 'password' => $user->getPassword(), 'enabled' => $user->isEnabled(), 'account_non_expired' => $user->isAccountNonExpired(), 'credentials_non_expired' => $user->isCredentialsNonExpired()]]);
 }