protected function updateUserPasswordHash(UserEntity $user, $password, Bcrypt $bcrypt) { $hash = explode('$', $user->getPassword()); if ($hash[2] === $bcrypt->getCost()) { return; } $user = $this->getHydrator()->hydrate(compact('password'), $user); $this->getMapper()->update($user); }
public function transferChangesToExistingEntity(UserInterface $newEntity, UserInterface $existingEntity) { $existingEntity->setUsername($newEntity->getUsername()); $existingEntity->setEmail($newEntity->getEmail()); $existingEntity->setDisplayName($newEntity->getDisplayName()); $existingEntity->setState($newEntity->getState()); $passwordHash = $newEntity->getPassword(); if (!empty($passwordHash)) { $existingEntity->setPassword($passwordHash); } }