本文整理汇总了PHP中CActiveRecordBehavior::beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecordBehavior::beforeDelete方法的具体用法?PHP CActiveRecordBehavior::beforeDelete怎么用?PHP CActiveRecordBehavior::beforeDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecordBehavior
的用法示例。
在下文中一共展示了CActiveRecordBehavior::beforeDelete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
public function beforeDelete($event)
{
foreach ($this->findAllAttaches() as $attach) {
$attach->delete();
}
return parent::beforeDelete($event);
}
示例2: beforeDelete
/** Will remove associated Gallery before object removal */
public function beforeDelete($event)
{
$gallery = $this->getGallery();
if ($gallery !== null) {
$gallery->delete();
}
parent::beforeDelete($event);
}
示例3: beforeDelete
/** Will remove associated Gallery before object removal */
public function beforeDelete($event)
{
if (!empty($this->getOwner()->{$this->idAttribute})) {
/** @var $gallery Gallery */
$gallery = Gallery::model()->findByPk($this->getOwner()->{$this->idAttribute});
$gallery->delete();
}
parent::beforeDelete($event);
}
示例4: beforeDelete
public function beforeDelete($event)
{
$model = $this->getOwner();
$files = FileManager::model()->findAllByAttributes(array('model_id' => get_class($model), 'object_id' => $model->id));
foreach ($files as $file) {
$file->delete();
}
return parent::beforeDelete($event);
}
示例5: beforeDelete
public function beforeDelete($event)
{
parent::beforeDelete($event);
if ($this->resolveMetaDataModel() !== null) {
if ($this->resolveMetaDataModel()->checkAccessDelete && Yii::app()->user->checkAccess($this->resolveMetaDataModel()->checkAccessDelete) === false) {
throw new CHttpException(403, "You are not authorized to perform this action. Access restricted by P3MetaDataBehavior.");
return false;
} else {
$this->resolveMetaDataModel()->delete();
}
}
return true;
}
示例6: beforeDelete
public function beforeDelete($event)
{
$this->removeImages();
parent::beforeDelete($event);
}
示例7: beforeDelete
public function beforeDelete($event)
{
parent::beforeDelete($event);
//erasing from youtube...
$utub = $this->getYouTube(true);
$utub->delete($utub->getFullVideoEntry($this->owner->youtubeId));
//from our cache...
Yii::app()->cache->delete('Video::' . $this->owner->youtubeId);
//and now we will let the method continue on deleting the database entry
return true;
}
示例8: beforeDelete
public function beforeDelete($event)
{
parent::beforeDelete($event);
$this->handleCollection();
}
示例9: beforeDelete
public function beforeDelete($event)
{
Yii::trace('deleting MANY_MANY data for ' . get_class($this->owner), 'system.db.ar.CActiveRecord');
foreach ($this->owner->relations() as $key => $relation) {
if ($relation['0'] == CActiveRecord::MANY_MANY) {
$this->executeManyManyEntry($this->makeManyManyDeleteCommand($relation[2], $this->owner->{$this->owner->tableSchema->primaryKey}, array()));
}
}
return parent::beforeDelete($event);
}
示例10: beforeDelete
/**
* @param CModelEvent $event
*/
public function beforeDelete($event)
{
// touch to allow afterDelete() to clearCache()
foreach ($this->cacheRelations as $cacheRelation) {
$this->owner->{$cacheRelation};
}
parent::beforeDelete($event);
}