main/core/Controller/ResourceController.php
public function downloadAction($forceArchive = false, Request $request)
    {
        $ids = $request->query->get('ids');
        $nodes = $this->om->findList(ResourceNode::class, 'uuid', $ids);

        $collection = new ResourceCollection($nodes);

        if (!$this->authorization->isGranted('EXPORT', $collection)) {
            throw new ResourceAccessException($collection->getErrorsForDisplay(), $collection->getResources());
        }

        $data = $this->manager->download($nodes, $forceArchive);

        $file = $data['file'] ?: tempnam('tmp', 'tmp');
        $fileName = $data['name'];

        if (!file_exists($file)) {
            return new JsonResponse(['file_not_found'], 500);
        }

        $fileName = null === $fileName ? $response->getFile()->getFilename() : $fileName;
        $fileName = str_replace('/', '_', $fileName);
        $fileName = str_replace('\\', '_', $fileName);

        $response = new BinaryFileResponse($file, 200, ['Content-Disposition' => "attachment; filename={$fileName}"]);

        return $response;
    }
public function downloadAction($forceArchive = false, Request $request)
    {
        $ids = $request->query->get('ids');
        $nodes = $this->om->findList(ResourceNode::class, 'uuid', $ids);

        $collection = new ResourceCollection($nodes);

        if (!$this->authorization->isGranted('EXPORT', $collection)) {
            throw new ResourceAccessException($collection->getErrorsForDisplay(), $collection->getResources());
        }

        $data = $this->manager->download($nodes, $forceArchive);

        $file = $data['file'] ?: tempnam('tmp', 'tmp');
        $fileName = $data['name'];

        if (!file_exists($file)) {
            return new JsonResponse(['file_not_found'], 500);
        }

        $fileName = null === $fileName ? $response->getFile()->getFilename() : $fileName;
        $fileName = str_replace('/', '_', $fileName);
        $fileName = str_replace('\\', '_', $fileName);

        $response = new BinaryFileResponse($file, 200, ['Content-Disposition' => "attachment; filename={$fileName}"]);

        return $response;
    }
public function downloadAction ( $ forceArchive = false , Request $ request ) { $ ids = $ request -> query -> get ( 'ids' ) ; $ nodes = $ this -> om -> findList ( ResourceNode :: class , 'uuid' , $ ids ) ; $ collection = new ResourceCollection ( $ nodes ) ; if ( ! $ this -> authorization -> isGranted ( 'EXPORT' , $ collection ) ) { throw new ResourceAccessException ( $ collection -> getErrorsForDisplay ( ) , $ collection -> getResources ( ) ) ; } $ data = $ this -> manager -> download ( $ nodes , $ forceArchive ) ; $ file = $ data [ 'file' ] ? : tempnam ( 'tmp' , 'tmp' ) ; $ fileName = $ data [ 'name' ] ; if ( ! file_exists ( $ file ) ) { return new JsonResponse ( [ 'file_not_found' ] , 500 ) ; } $ fileName = null === $ fileName ? $ response -> getFile ( ) -> getFilename ( ) : $ fileName ; $ fileName = str_replace ( '/' , '_' , $ fileName ) ; $ fileName = str_replace ( '\\' , '_' , $ fileName ) ; $ response = new BinaryFileResponse ( $ file , 200 , [ 'Content-Disposition' => "attachment; filename={$fileName}" ] ) ; return $ response ; }
Downloads a list of Resources.

@EXT\Route(
"/download",
name="claro_resource_download",
defaults ={"forceArchive"=false}
)
@EXT\Route(
"/download/{forceArchive}",
name="claro_resource_download",
requirements={"forceArchive" = "^(true|false|0|1)$"},
)

@param bool    $forceArchive
@param Request $request

@return Response
Downloads a list of Resources .