Exemplo n.º 1
0
 public function find($id)
 {
     if ($this->_hasIdentity($id)) {
         return $this->_getIdentity($id);
     }
     $rowset = $this->getDbTable()->find($id);
     if ($rowset->count() != 1) {
         return;
     }
     $row = $rowset->current();
     $entry = new Model_BlogEntry(array('id' => $row->id, 'title' => $row->title, 'content' => $row->content));
     $entry->setReferenceId('author', $row->author_id);
     $this->_setIdentity($id, $entry);
     return $entry;
 }
Exemplo n.º 2
0
 /**
  * deleteAction
  * @author Daniel Rotter <*****@*****.**>
  * @version 1.0
  */
 public function deleteAction()
 {
     $this->core->logger->debug('widgets->blog->FormController->deleteAction()');
     try {
         $this->getModelBlogEntry();
         if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
             $this->objModelBlogEntry->deleteBlogEntry($this->objRequest->getParam('id'));
             $this->view->blnShowFormAlert = true;
         }
         $this->renderScript('blog/form.phtml');
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
Exemplo n.º 3
0
 public function testCreate()
 {
     $model = new Model_BlogEntry();
     $expect = array('id' => null, 'title' => '', 'content' => '', 'author' => null);
     $this->assertEquals($expect, $model->toArray());
 }