public function beforeDelete($event)
 {
     foreach ($this->findAllAttaches() as $attach) {
         $attach->delete();
     }
     return parent::beforeDelete($event);
 }
Beispiel #2
0
 /** Will remove associated Gallery before object removal */
 public function beforeDelete($event)
 {
     $gallery = $this->getGallery();
     if ($gallery !== null) {
         $gallery->delete();
     }
     parent::beforeDelete($event);
 }
Beispiel #3
0
 /** 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);
 }
 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);
 }
Beispiel #5
0
 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;
 }
 public function beforeDelete($event)
 {
     $this->removeImages();
     parent::beforeDelete($event);
 }
 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;
 }
 public function beforeDelete($event)
 {
     parent::beforeDelete($event);
     $this->handleCollection();
 }
 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);
 }
 /**
  * @param CModelEvent $event
  */
 public function beforeDelete($event)
 {
     // touch to allow afterDelete() to clearCache()
     foreach ($this->cacheRelations as $cacheRelation) {
         $this->owner->{$cacheRelation};
     }
     parent::beforeDelete($event);
 }