PHP Class Sulu\Component\HttpCache\EventSubscriber\InvalidationSubscriber

TODO: the url-gathering for changed documents should not be implemented in this class.
Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
Show file Open project: sulu/sulu

Public Methods

Method Description
__construct ( Sulu\Component\HttpCache\HandlerInvalidatePathInterface $pathHandler, Sulu\Component\HttpCache\HandlerInvalidateStructureInterface $structureHandler, Sulu\Component\Content\Compat\StructureManagerInterface $structureManager, DocumentInspector $documentInspector, Sulu\Component\Content\Types\ResourceLocator\Strategy\ResourceLocatorStrategyPoolInterface $resourceLocatorStrategyPool, Sulu\Component\Webspace\Manager\WebspaceManagerInterface $webspaceManager, string $environment )
getSubscribedEvents ( )
invalidateDocumentBeforePublishing ( Sulu\Component\DocumentManager\Event\PublishEvent $event ) Invalidates the assigned structure and all urls in the locale of the document of an already published document when it gets republished (eg on content change).
invalidateDocumentBeforeRemoving ( Sulu\Component\DocumentManager\Event\RemoveEvent $event ) Invalidates the assigned structure and all urls in all locales of the document when a document gets removed.
invalidateDocumentBeforeUnpublishing ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event ) Invalidates the assigned structure and all urls in the locale of the document when a document gets unpublished.

Private Methods

Method Description
getLocaleUrls ( Sulu\Component\Content\Document\Behavior\ResourceSegmentBehavior $document, string $locale ) : array Returns all urls of the given locale which are associated with the given document.
invalidateDocumentStructure ( $document ) Invalidates the structure of the given document.
invalidateDocumentUrls ( $document, $locale ) Invalidates all urls which are assigned to the given document in the given locale.

Method Details

__construct() public method

public __construct ( Sulu\Component\HttpCache\HandlerInvalidatePathInterface $pathHandler, Sulu\Component\HttpCache\HandlerInvalidateStructureInterface $structureHandler, Sulu\Component\Content\Compat\StructureManagerInterface $structureManager, DocumentInspector $documentInspector, Sulu\Component\Content\Types\ResourceLocator\Strategy\ResourceLocatorStrategyPoolInterface $resourceLocatorStrategyPool, Sulu\Component\Webspace\Manager\WebspaceManagerInterface $webspaceManager, string $environment )
$pathHandler Sulu\Component\HttpCache\HandlerInvalidatePathInterface
$structureHandler Sulu\Component\HttpCache\HandlerInvalidateStructureInterface
$structureManager Sulu\Component\Content\Compat\StructureManagerInterface
$documentInspector Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector
$resourceLocatorStrategyPool Sulu\Component\Content\Types\ResourceLocator\Strategy\ResourceLocatorStrategyPoolInterface
$webspaceManager Sulu\Component\Webspace\Manager\WebspaceManagerInterface
$environment string - kernel envionment, dev, prod, etc

getSubscribedEvents() public static method

public static getSubscribedEvents ( )

invalidateDocumentBeforePublishing() public method

This method is executed before the actual publishing of the document to avoid purging new urls.
public invalidateDocumentBeforePublishing ( Sulu\Component\DocumentManager\Event\PublishEvent $event )
$event Sulu\Component\DocumentManager\Event\PublishEvent

invalidateDocumentBeforeRemoving() public method

This method is executed before the actual removing of the document because the document must still exist to gather the urls of the document.
public invalidateDocumentBeforeRemoving ( Sulu\Component\DocumentManager\Event\RemoveEvent $event )
$event Sulu\Component\DocumentManager\Event\RemoveEvent

invalidateDocumentBeforeUnpublishing() public method

This method is executed before the actual unpublishing of the document because the document must still be published to gather the urls of the document.
public invalidateDocumentBeforeUnpublishing ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event )
$event Sulu\Component\DocumentManager\Event\UnpublishEvent