Example #1
0
 public function beforeDelete()
 {
     if ($this->default) {
         return false;
     }
     return parent::beforeDelete();
 }
 public function beforeDelete()
 {
     Comment::model()->deleteAllByAttributes(array('post_id' => $this->id));
     return parent::beforeDelete();
 }
Example #3
0
 protected function beforeDelete()
 {
     parent::beforeDelete();
     return true;
 }
Example #4
0
    protected function beforeDelete() {
        parent::beforeDelete();
        ArticleVote::model()->deleteAllByAttributes(array('article'=>$this->id));
        $this->getDeleteFileFolder();
        // all comments remove
        CommentArticle::model()->deleteAllByAttributes(array(
				'object_pk'=>$this->id
		));
        return true;
    }
Example #5
0
	public function beforeDelete()
	{
		if($this->status == self::STATUS_APPROVED){
			$this->starRatingBack($this->object_pk, $this->rating);
		}
		if($this->id_parent == null){
			self::model()->deleteAllByAttributes(array('id_parent'=>$this->id));
		}
		return parent::beforeDelete();
	}
Example #6
0
 /**
  * Delete category pages and childs.
  * @return boolean
  */
 public function beforeDelete()
 {
     // Delete pages
     $pages = $this->pages;
     if ($pages) {
         foreach ($pages as $p) {
             $p->delete();
         }
     }
     // Delete all child categories
     $tree = new PageCategoryTree();
     $tree = $tree->buildTree($this->id);
     if (count($tree) > 0) {
         foreach ($tree as $child) {
             $child->delete();
         }
     }
     return parent::beforeDelete();
 }
Example #7
0
     protected function beforeDelete(){
        if(!parent::beforeDelete())
            return false;
        Comment::model()->updateAll(array('user_id'=>0),array('condition'=>'user_id='.$this->id));
        ObjectsImages::model()->updateAll(array('uploaded_by'=>null),array('condition'=>'uploaded_by='.$this->id));
        Objects::model()->updateAll(array('author'=>null),array('condition'=>'author='.$this->id));

        $this->deleteModelDir(); // удалили модель? удаляем и файл и всю папку
        return true;
    }