/**
  * @Route("/book/{id}/download", requirements={
  *     "id": "\d+"
  * })
  */
 public function downloadAction($id)
 {
     $repository = $this->getDoctrine()->getRepository('AppBundle:Book');
     $book = $repository->find($id);
     $response = new Response();
     $file = $book->getBookFile();
     $response->headers->set('Content-Type', $file->getMimeType());
     $response->headers->set('Content-Disposition', 'attachment;filename="' . $file->getFileName());
     $response->setContent(file_get_contents(Book::getUploadsDirectory() . '/' . $book->getFilePath()));
     return $response;
 }