Пример #1
0
 public function addAction()
 {
     $form = new AccountForm();
     $form->get('submit')->setValue('Add');
     $element = new Element\Text('my-text');
     $element->setLabel('Please note your account #')->setLabelAttributes(array('class' => 'note-label'));
     $request = $this->getRequest();
     if ($request->isPost()) {
         $account = new Account();
         $form->setInputFilter($account->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $account->exchangeArray($form->getData());
             $account->movie_id_1 = '';
             $account->movie_id_2 = '';
             $account->movie_id_3 = '';
             $this->getAccountTable()->saveAccount($account);
             // Redirect to list of Accounts
             return $this->redirect()->toRoute('movie', array('id' => $account->id));
         }
     }
     return array('form' => $form, 'element' => $element);
 }