/** * Update the session if user has updated their profile * * @param int $saved * @param UserModel $model */ private function updateSession($saved, UserModel $model) { /* @var $auth \Zend\Authentication\AuthenticationService */ $auth = $this->getService('Zend\\Authentication\\AuthenticationService'); $identity = $auth->getIdentity(); // if user has updated this details write the update model to session if ($saved && $model instanceof UserModel && $model->getUserId() === $identity->getUserId()) { $auth->getStorage()->write($model); } }
/** * @param \UthandoUser\Model\User $object * @return array */ public function extract($object) { return ['userId' => $object->getUserId(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), 'email' => $object->getEmail(), 'passwd' => $this->extractValue('passwd', $object->getPasswd()), 'role' => $object->getRole(), 'dateCreated' => $this->extractValue('dateCreated', $object->getDateCreated()), 'dateModified' => $this->extractValue('dateModified', $object->getDateModified()), 'active' => $this->extractValue('active', $object->getActive())]; }