Ejemplo n.º 1
0
 public function indexxAction()
 {
     $loEntityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $loUser = new Access();
     $loForm = new RegistrationForm();
     $loForm->get('submit')->setValue('Register');
     $loForm->setHydrator(new DoctrineHydrator($loEntityManager, 'Access\\Entity\\Access'));
     if ($this->requestIsPost()) {
         $loForm->setInputFilter(new RegistrationFilter($this->getServiceLocator()));
         $loForm->setData($this->requestPost());
         if ($loForm->isValid()) {
             $poUser->set('stPasswordSalt', String::generateDynamicSalt());
             $poUser->set('UserGroup_Id', null);
             $poUser->set('stRegistrationToken', md5(uniqid(mt_rand(), true)));
             $loUser->populate($loForm->getData());
             $this->sendConfirmationEmail($loUser);
             $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'success', $loUser->getEmail()));
             $loEntityManager->persist($loUser);
             $loEntityManager->flush();
         }
     }
     return new ViewModel(array('form' => $loForm));
 }