Ojs\SiteBundle\Controller\DownloadController::issueFileAction PHP Метод

issueFileAction() публичный Метод

public issueFileAction ( IssueFile $issueFile ) : BinaryFileResponse
$issueFile Ojs\JournalBundle\Entity\IssueFile
Результат Symfony\Component\HttpFoundation\BinaryFileResponse
    public function issueFileAction(IssueFile $issueFile)
    {
        $fileManager = $this->get('jb_fileuploader.file_history.manager');
        $rootDir = $this->getParameter('kernel.root_dir');
        $assetHelper = $this->get('templating.helper.assets');
        $fileHistory = $fileManager->findOneByFileName($issueFile->getFile());
        $path = $rootDir . '/../web' . $fileManager->getUrl($fileHistory);
        $path = preg_replace('/\\?' . $assetHelper->getVersion() . '$/', '', $path);
        $fileOriginalName = $fileHistory->getOriginalName();
        if (preg_match('/\\//', $fileHistory->getOriginalName())) {
            $explode = explode('/', $fileHistory->getOriginalName());
            $fileOriginalName = end($explode);
        }
        $fs = new Filesystem();
        if (!$fs->exists($path)) {
            throw $this->createNotFoundException();
        }
        $response = new BinaryFileResponse($path);
        $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE, preg_replace('/[[:^print:]]/', '_', $fileOriginalName));
        $event = new DownloadIssueFileEvent($issueFile);
        $dispatcher = $this->get('event_dispatcher');
        $dispatcher->dispatch(SiteEvents::DOWNLOAD_ISSUE_FILE, $event);
        return $response;
    }