protected function _deleteFile(Model $model, $field, $path, $column) {
        if (empty($this->settings[$model->alias][$field])) {
            return false;
        }

        $attachment = $this->_settingsCallback($model, $this->settings[$model->alias][$field]);
        $basePath = $attachment['uploadDir'] ?: $attachment['tempDir'];

        // Get uploadDir from transform
        if ($attachment['transforms']) {
            foreach ($attachment['transforms'] as $transform) {
                if ($transform['dbColumn'] === $column) {
                    $basePath = $transform['uploadDir'];
                }
            }
        }

        try {
            // Delete remote file
            if ($attachment['transport']) {
                $transporter = $this->_getTransporter($attachment, $attachment['transport']);

                return $transporter->delete($path);

            // Delete local file
            } else {
                $file = new File($basePath . basename($path));

                return $file->delete();
            }

        } catch (Exception $e) {
            $this->log($e->getMessage(), LOG_DEBUG);
        }

        return false;
    }
protected function _deleteFile(Model $model, $field, $path, $column) {
        if (empty($this->settings[$model->alias][$field])) {
            return false;
        }

        $attachment = $this->_settingsCallback($model, $this->settings[$model->alias][$field]);
        $basePath = $attachment['uploadDir'] ?: $attachment['tempDir'];

        // Get uploadDir from transform
        if ($attachment['transforms']) {
            foreach ($attachment['transforms'] as $transform) {
                if ($transform['dbColumn'] === $column) {
                    $basePath = $transform['uploadDir'];
                }
            }
        }

        try {
            // Delete remote file
            if ($attachment['transport']) {
                $transporter = $this->_getTransporter($attachment, $attachment['transport']);

                return $transporter->delete($path);

            // Delete local file
            } else {
                $file = new File($basePath . basename($path));

                return $file->delete();
            }

        } catch (Exception $e) {
            $this->log($e->getMessage(), LOG_DEBUG);
        }

        return false;
    }
protected function _deleteFile ( Model $ model , $ field , $ path , $ column ) { if ( empty ( $ this -> settings [ $ model -> alias ] [ $ field ] ) ) { return false ; } $ attachment = $ this -> _settingsCallback ( $ model , $ this -> settings [ $ model -> alias ] [ $ field ] ) ; $ basePath = $ attachment [ 'uploadDir' ] ? : $ attachment [ 'tempDir' ] ; // Get uploadDir from transform if ( $ attachment [ 'transforms' ] ) { foreach ( $ attachment [ 'transforms' ] as $ transform ) { if ( $ transform [ 'dbColumn' ] === $ column ) { $ basePath = $ transform [ 'uploadDir' ] ; } } } try { // Delete remote file if ( $ attachment [ 'transport' ] ) { $ transporter = $ this -> _getTransporter ( $ attachment , $ attachment [ 'transport' ] ) ; return $ transporter -> delete ( $ path ) ; // Delete local file } else { $ file = new File ( $ basePath . basename ( $ path ) ) ; return $ file -> delete ( ) ; } } catch ( Exception $ e ) { $ this -> log ( $ e -> getMessage ( ) , LOG_DEBUG ) ; } return false ; }
Attempt to delete a file using the attachment settings.

@uses Transit\File

@param Model $model
@param string $field
@param string $path
@param string $column
@return bool
Attempt to delete a file using the attachment settings .