本文整理汇总了PHP中BaseModel::beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::beforeDelete方法的具体用法?PHP BaseModel::beforeDelete怎么用?PHP BaseModel::beforeDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::beforeDelete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
public function beforeDelete()
{
if ($this->default) {
return false;
}
return parent::beforeDelete();
}
示例2: beforeDelete
public function beforeDelete()
{
Comment::model()->deleteAllByAttributes(array('post_id' => $this->id));
return parent::beforeDelete();
}
示例3: beforeDelete
protected function beforeDelete()
{
parent::beforeDelete();
return true;
}
示例4: beforeDelete
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;
}
示例5: beforeDelete
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();
}
示例6: beforeDelete
/**
* 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();
}
示例7: beforeDelete
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;
}