class DocumentLifeCycleSubscriber implements EventSubscriber (View source)

Handle file management on documents lifecycle events.

Methods

__construct(Container $container)

DocumentLifeCycleSubscriber constructor.

getSubscribedEvents()

[email protected]}

postRemove(LifecycleEventArgs $args)

Unlink file after document has been deleted.

bool
cleanFileDirectory(Document $document)

Remove document directory if there is no other file in it.

Details

__construct(Container $container)

DocumentLifeCycleSubscriber constructor.

We need to pass whole container not to trigger asset packages initialization and not to creation a dependency infinite loop.

Parameters

Container $container

getSubscribedEvents()

[email protected]}

postRemove(LifecycleEventArgs $args)

Unlink file after document has been deleted.

Parameters

LifecycleEventArgs $args

protected bool cleanFileDirectory(Document $document)

Remove document directory if there is no other file in it.

Parameters

Document $document

Return Value

bool