Ejemplo n.º 1
0
 public function savePortfolioAction()
 {
     $this->auth();
     $id = (int) $this->params()->fromRoute('id');
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('DbAdapter');
     $portfolioTable = new PortfolioTable($dbAdapter);
     $post = $this->request->getPost();
     $portfolio = new Portfolio();
     $form = new PortfolioForm();
     $form->setData($post);
     if ($form->isValid()) {
         $data = $form->getData();
         $portfolio->exchangeArray($data);
         $portfolio->id = $id;
         $portfolioTable->savePortfolio($portfolio);
         return $this->redirect()->toUrl('/admin/portfolios');
     }
 }