public function registerAction() { $options = $this->getRequest()->getPost(); $user = new User(); $user->exchangeArray(iterator_to_array($options)); var_dump($user); $res = $this->getServiceLocator()->get('User\\Table\\UserTable')->insertUser($user); $this->redirect()->toRoute('application'); }
/** * Returns true if and only if email not exists in users table * * @param string $value * @return boolean * @throws \Exception */ public function isValid($value) { $this->setValue($value); if (null !== $this->authService) { $user = $this->authService->getAuthentificatedUserEntity(); if ($user && $user->username == $value) { return true; } } $user = $this->storage->getByEmail($value); if ($user) { $this->error(self::EMAIL_IN_USE); return false; } return true; }
/** * Returns logged user entity * * @return UserEntity|false */ public function getAuthentificatedUserEntity() { if (!$this->sessionContainer->userEntity && $this->isLoggedIn()) { $user = $this->userTable->getByEmail($this->authService->getIdentity()); if ($user) { $this->sessionContainer->userEntity = $user->getValues(); } } if ($this->sessionContainer->userEntity) { if (null === $this->authentificatedUser) { $this->authentificatedUser = $this->userTable->create($this->sessionContainer->userEntity); } return $this->authentificatedUser; } return false; }