/** * @param UserInterface $user * @param string $provider * @param \Hybrid_User_Profile $userProfile * @return mixed */ protected function update(UserInterface $user, $provider, \Hybrid_User_Profile $userProfile) { $user->setDisplayName($userProfile->displayName); $user->setEmail($userProfile->email); $options = array('user' => $user, 'provider' => $provider, 'userProfile' => $userProfile); $this->getEventManager()->trigger('scnUpdateUser.pre', $this, $options); $result = $this->getZfcUserMapper()->update($user); $this->getEventManager()->trigger('scnUpdateUser.post', $this, $options); return $result; }
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); } }