Пример #1
0
 public function save(Application_Model_Post $post)
 {
     $data = array('title' => $post->getTitle(), 'body' => $post->getBody(), 'created' => $post->getCreated());
     if (null === ($id = $post->getId())) {
         unset($data['id']);
         $data['created'] = date('Y-m-d H:i:s');
         $post->setId($this->getDbTable()->insert($data));
     } else {
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
 }