Exemple #1
0
 /**
  * Overload Sprig::delete() to remove tags
  * from the article-tag pivot table
  */
 public function delete(Database_Query_Builder_Delete $query = NULL)
 {
     Kohana::$log->add(Kohana::DEBUG, 'Beginning article deletion for article_id=' . $this->id);
     if (Kohana::$profiling === TRUE) {
         $benchmark = Profiler::start('blog', 'delete article');
     }
     try {
         DB::delete('articles_tags')->where('article_id', '=', $this->id)->execute();
     } catch (Database_Exception $e) {
         Kohana::$log->add(Kohana::ERROR, 'Exception occured while modifying deleted article\'s tags. ' . $e->getMessage());
         return $this;
     }
     if (isset($benchmark)) {
         Profiler::stop($benchmark);
     }
     return parent::delete($query);
 }
Exemple #2
0
 public function _init()
 {
     parent::_init();
     $this->_fields += array('text' => new Sprig_Field_Versioned(), 'title' => new Sprig_Field_Tracked(array('empty' => TRUE)), 'revisions' => new Sprig_Field_HasMany(array('model' => 'Entry_Revision')));
 }
Exemple #3
0
 public function _init()
 {
     parent::_init();
     $this->_fields += array('title' => new Sprig_Field_Tracked(array('empty' => TRUE)), 'text' => new Sprig_Field_Versioned(), 'revisions' => new Sprig_Field_HasMany(array('model' => 'Page_Revision')), 'comment' => new Sprig_Field_Char(array('in_db' => FALSE)));
 }