src/Graviton/FileBundle/Controller/FileController.php
public function getAction(Request $request, $id)
    {
        // If a json request, let parent handle it
        if (in_array('application/json', $request->getAcceptableContentTypes())) {
            return parent::getAction($request, $id);
        }

        /** @var File $file */
        $file = $this->getModel()->find($id);

        /** @var Response $response */
        return $this->fileManager->buildGetContentResponse(
            $this->getResponse(),
            $file
        );
    }
public function getAction(Request $request, $id)
    {
        // If a json request, let parent handle it
        if (in_array('application/json', $request->getAcceptableContentTypes())) {
            return parent::getAction($request, $id);
        }

        /** @var File $file */
        $file = $this->getModel()->find($id);

        /** @var Response $response */
        return $this->fileManager->buildGetContentResponse(
            $this->getResponse(),
            $file
        );
    }
public function getAction ( Request $ request , $ id ) { // If a json request, let parent handle it if ( in_array ( 'application/json' , $ request -> getAcceptableContentTypes ( ) ) ) { return parent :: getAction ( $ request , $ id ) ; } /** @var File $file */ $ file = $ this -> getModel ( ) -> find ( $ id ) ; /** @var Response $response */ return $ this -> fileManager -> buildGetContentResponse ( $ this -> getResponse ( ) , $ file ) ; }
respond with document if non json mime-type is requested

@param Request $request Current http request
@param string  $id      id of file

@return Response
respond with document if non json mime - type is requested