Beispiel #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);
 }