class Document extends BaseCachedFile implements EventSubscriberInterface

Document management actions. This class handles document processing an caching.

Basically, documents are stored outside the web space (by default in local/media/documents), and cached in the web space (by default in web/local/documents).

In the documents caches directory, a subdirectory for documents categories (eg. product, category, folder, etc.) is automatically created, and the cached document is created here. Plugin may use their own subdirectory as required.

The cached document name contains a hash of the processing options, and the original (normalized) name of the document.

A copy (or symbolic link, by default) of the original document is always created in the cache, so that the full resolution document is always available.

If a problem occurs, an DocumentException may be thrown.

Constants

CONFIG_DELIVERY_MODE

Methods

mixed
genericToggleVisibility( ModelCriteria $query, ToggleVisibilityEvent $event, EventDispatcherInterface $dispatcher = null)

Toggle visibility for an object

from  BaseAction
__construct( FileManager $fileManager)

No description

clearCache( CachedFileEvent $event)

Clear the file cache. Is a subdirectory is specified, only this directory is cleared.

saveFile( FileCreateOrUpdateEvent $event)

Take care of saving a file in the database and file storage

updateFile( FileCreateOrUpdateEvent $event)

Take care of updating file in the database and file storage

deleteFile( FileDeleteEvent $event)

Deleting file in the database and in storage

updatePosition( UpdateFilePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)

No description

toggleVisibility( FileToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)

No description

processDocument( DocumentEvent $event)

Process document and write the result in the document cache.

static 
getSubscribedEvents()

{@inheritdoc}

Details

in BaseAction at line 130
mixed genericToggleVisibility( ModelCriteria $query, ToggleVisibilityEvent $event, EventDispatcherInterface $dispatcher = null)

Toggle visibility for an object

Parameters

ModelCriteria $query
ToggleVisibilityEvent $event
EventDispatcherInterface $dispatcher

Return Value

mixed

in BaseCachedFile at line 49
__construct( FileManager $fileManager)

Parameters

FileManager $fileManager

in BaseCachedFile at line 66
clearCache( CachedFileEvent $event)

Clear the file cache. Is a subdirectory is specified, only this directory is cleared.

If no directory is specified, the whole cache is cleared. Only files are deleted, directories will remain.

Parameters

CachedFileEvent $event

in BaseCachedFile at line 199
saveFile( FileCreateOrUpdateEvent $event)

Take care of saving a file in the database and file storage

Parameters

FileCreateOrUpdateEvent $event Image event

Exceptions

Exception

in BaseCachedFile at line 239
updateFile( FileCreateOrUpdateEvent $event)

Take care of updating file in the database and file storage

Parameters

FileCreateOrUpdateEvent $event Image event

Exceptions

FileException

in BaseCachedFile at line 262
deleteFile( FileDeleteEvent $event)

Deleting file in the database and in storage

Parameters

FileDeleteEvent $event Image event

in BaseCachedFile at line 267
updatePosition( UpdateFilePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)

Parameters

UpdateFilePositionEvent $event
$eventName
EventDispatcherInterface $dispatcher

in BaseCachedFile at line 272
toggleVisibility( FileToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)

Parameters

FileToggleVisibilityEvent $event
$eventName
EventDispatcherInterface $dispatcher

at line 70
processDocument( DocumentEvent $event)

Process document and write the result in the document cache.

When the original document is required, create either a symbolic link with the original document in the cache dir, or copy it in the cache dir if it's not already done.

This method updates the cachefilepath and file_url attributes of the event

Parameters

DocumentEvent $event Event

Exceptions

DocumentException
InvalidArgumentException , DocumentException

at line 111
static getSubscribedEvents()

{@inheritdoc}