class DocumentHandler (View source)

Handle operations with documents entities.

Properties

protected $document

Methods

__construct(Document $document)

Create a new document handler with document to handle.

makePrivate()

Make current document private moving its file to the secured /files/private folder.

makePublic()

Make current document public moving off its file from the secured /files/private folder into /files folder.

Response
getDownloadResponse()

Get a Response object to force download document.

array
getFolders(Translation $translation = null)

Return documents folders with the same translation as current document.

Details

__construct(Document $document)

Create a new document handler with document to handle.

Parameters

Document $document

makePrivate()

Make current document private moving its file to the secured /files/private folder.

You must explicitly call flush after this method.

makePublic()

Make current document public moving off its file from the secured /files/private folder into /files folder.

You must explicitly call flush after this method.

Response getDownloadResponse()

Get a Response object to force download document.

This method works for both private and public documents.

Be careful, this method will send headers.

Return Value

Response

array getFolders(Translation $translation = null)

Return documents folders with the same translation as current document.

Parameters

Translation $translation

Return Value

array