本文整理匯總了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);
}