src/Controller/Traits/ImportTrait.php
public function importDownload(string $id, string $type = 'original') : Response
    {
        $table = TableRegistry::get('CsvMigrations.Imports');
        $entity = $table->get($id);
        Assert::isInstanceOf($entity, Import::class);

        $path = $entity->get('filename');
        if ('processed' === $type) {
            $path = ImportUtility::getProcessedFile($entity);
        }

        return $this->response->withFile($path, ['download' => true]);
    }
public function importDownload(string $id, string $type = 'original') : Response
    {
        $table = TableRegistry::get('CsvMigrations.Imports');
        $entity = $table->get($id);
        Assert::isInstanceOf($entity, Import::class);

        $path = $entity->get('filename');
        if ('processed' === $type) {
            $path = ImportUtility::getProcessedFile($entity);
        }

        return $this->response->withFile($path, ['download' => true]);
    }
public function importDownload ( string $ id , string $ type = 'original' ) : Response { $ table = TableRegistry :: get ( 'CsvMigrations.Imports' ) ; $ entity = $ table -> get ( $ id ) ; Assert :: isInstanceOf ( $ entity , Import :: class ) ; $ path = $ entity -> get ( 'filename' ) ; if ( 'processed' === $ type ) { $ path = ImportUtility :: getProcessedFile ( $ entity ) ; } return $ this -> response -> withFile ( $ path , [ 'download' => true ] ) ; }
Import download action.

@param string $id Import id
@param string $type Export Type (supported values: 'original', 'processed')
@return \Cake\Http\Response
Import download action .