public static function onUserDelete($event) { foreach (File::findAll(array('created_by' => $event->sender->id)) as $file) { $file->delete(); } return true; }
/** * Draw the widget */ public function run() { $files = array(); if ($this->object !== null) { if ($this->object->isNewRecord && $this->object->getRelation('content', false) !== null) { $files = File::findAll(['guid' => array_map('trim', explode(',', $this->object->content->attachFileGuidsAfterSave))]); } else { $files = File::getFilesOfObject($this->object); } } return $this->render('fileUploadList', array('uploaderId' => $this->uploaderId, 'files' => $files)); }