示例#1
0
 public function addAction()
 {
     $form = new MovieForm();
     $form->get('submit')->setValue('Add');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $movie = new Movie();
         $form->setInputFilter($movie->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $movie->exchangeArray($form->getData());
             $this->getMovieTable()->saveMovie($movie);
             /* $id = $this->params()->fromRoute('id', 0);  
                $account = new Account();
                $account->getAccountTable()->getAccount($id);
                //$account->movie_id_1 = $form->get('id');
                //$form->bind($account);
                var_dump($form->get('id'));
                var_dump($account);
                exit;
                */
             // Redirect to list of movies
             return $this->redirect()->toRoute('movie');
         }
     }
     return array('form' => $form);
 }
 public function addAction()
 {
     $form = new MovieForm();
     $form->get('submit')->setValue('Add');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $movie = new Movie();
         $form->setInputFilter($movie->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $movie->exchangeArray($form->getData());
             $this->getMovieTable()->saveMovie($movie);
             // Redirect to list of movies
             return $this->redirect()->toRoute('movie');
         }
     }
     return array('form' => $form);
 }