public function beforeDelete($event)
    {
        $oldId = $this->owner->{$this->savedAttribute};
        if (($oldModel = FileModel::findOne($oldId)) !== null) {
            $event->isValid = $event->isValid && $oldModel->delete();
        }
    }
public function beforeDelete($event)
    {
        $oldId = $this->owner->{$this->savedAttribute};
        if (($oldModel = FileModel::findOne($oldId)) !== null) {
            $event->isValid = $event->isValid && $oldModel->delete();
        }
    }
public function beforeDelete ( $ event ) { $ oldId = $ this -> owner -> { $ this -> savedAttribute } ; if ( ( $ oldModel = FileModel :: findOne ( $ oldId ) ) !== null ) { $ event -> isValid = $ event -> isValid && $ oldModel -> delete ( ) ; } }
Event handler for beforeDelete
@param \yii\base\ModelEvent $event
Event handler for beforeDelete