Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. /**
  2.      * Action to download a zip package of documents according to a user with.
  3.      *
  4.      * idDocuments array of id documents to download
  5.      *
  6.      * @Route("/user/documents/download/zip", name="downloadDocumentZipAPI")
  7.      *
  8.      * @param Request $request
  9.      *
  10.      * @return Response
  11.      */
  12.     public function downloadZipAction(Request $request)
  13.     {
  14.         $idUser = $this->getUser()->getId();
  15.  
  16.         $idDocuments = $request->get('idDocuments', []);
  17.  
  18.         $documentsBinary = $this->getClient()->downloadZIPUserDocuments($idUser, $idDocuments);
  19.  
  20.         if (!$documentsBinary) {
  21.             return new JsonResponse(['statusCode' => 404], 404);
  22.         }
  23.  
  24.         $response = Response::create($documentsBinary->getBody()->getContents(), $documentsBinary->getStatusCode(), $documentsBinary->getHeaders());
  25.  
  26.         return $response;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement