public function editAction()
 {
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         return $this->redirect()->toRoute('movie', array('action' => 'add'));
     }
     // Get the Movie with the specified id.  An exception is thrown
     // if it cannot be found, in which case go to the index page.
     try {
         $movie = $this->getMovieTable()->getMovie($id);
     } catch (\Exception $ex) {
         return $this->redirect()->toRoute('movie', array('action' => 'index'));
     }
     $form = new MovieForm();
     $form->bind($movie);
     $form->get('submit')->setAttribute('value', 'Edit');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setInputFilter($movie->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $this->getMovieTable()->saveMovie($movie);
             // Redirect to list of movies
             return $this->redirect()->toRoute('movie');
         }
     }
     return array('id' => $id, 'form' => $form);
 }