コード例 #1
0
 public function testGetInputFilter()
 {
     $post = new Post();
     $if = $post->getInputFilter();
     //testa se existem filtros
     $this->assertInstanceOf("Zend\\InputFilter\\InputFilter", $if);
     return $if;
 }
コード例 #2
0
 /**
  * Cria ou edita um post
  * @return void
  */
 public function saveAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $data = $request->getPost();
         $post = new Post();
         $post->setData($data);
         $saved = $this->getTable('Skel\\Model\\Post')->save($post);
         return $this->redirect()->toUrl('/skel/index');
     }
     $id = (int) $this->params()->fromRoute('id', 0);
     if ($id > 0) {
         return new ViewModel(array('post' => $this->getTable('Skel\\Model\\Post')->get($id)));
     }
 }