Model/DocumentService.php
/**
     * Download document
     * @param  Document $document
     * @return bytes
     * @throws If the given document's class doesn't implement DocumentInterface
     */
Download document
@param  Document $document
@return bytes
@throws If the given document's class doesn't implement DocumentInterface
Download document @param Document $document @return bytes @throws If the given document ' s class doesn ' t implement DocumentInterface
public function download(Document $document)
    {
        if( ! ($document instanceOf DocumentInterface) ){
            throw new DocumentException([], "Document doesn't implements DocumentInterface", 1);
        }
        $handler = $this->container->get('vich_uploader.download_handler');
        if( ! is_null($document->getDocumentMeta()))
            $file = $handler->downloadObject($document, $document->getFileField(), null, $document->getDocumentMeta()->getOriginalName());
        else
            $file = $handler->downloadObject($document, $document->getFileField());
        return $file;
    }
public function download ( Document $ document ) { if ( ! ( $ document instanceOf DocumentInterface ) ) { throw new DocumentException ( [ ] , " Document doesn't implements DocumentInterface " , 1 ) ; } $ handler = $ this -> container -> get ( 'vich_uploader.download_handler' ) ; if ( ! is_null ( $ document -> getDocumentMeta ( ) ) ) $ file = $ handler -> downloadObject ( $ document , $ document -> getFileField ( ) , null , $ document -> getDocumentMeta ( ) -> getOriginalName ( ) ) ; else $ file = $ handler -> downloadObject ( $ document , $ document -> getFileField ( ) ) ; return $ file ; }
Download document
 @param  Document $document
 @return bytes
 @throws If the given document's class doesn't implement DocumentInterface
Download document @param Document $document @return bytes @throws If the given document ' s class doesn ' t implement DocumentInterface