PHP Class Sulu\Component\Content\Document\Subscriber\WorkflowStageSubscriber

Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
Show file Open project: sulu/sulu Class Usage Examples

Public Methods

Method Description
__construct ( Sulu\Component\DocumentManager\PropertyEncoder $propertyEncoder, Sulu\Component\DocumentManager\DocumentInspector $documentInspector, PHPCR\SessionInterface $defaultSession, PHPCR\SessionInterface $liveSession )
getSubscribedEvents ( )
setWorkflowStageOnDocument ( Sulu\Component\DocumentManager\Event\HydrateEvent $event ) Sets the workflow properties from the node on the document.
setWorkflowStageToPublished ( Sulu\Component\DocumentManager\Event\PublishEvent $event ) Sets the workflow stage for the passed document to published.
setWorkflowStageToTest ( Sulu\Component\DocumentManager\Event\PersistEvent $event ) Sets the workflow stage for the passed document to test.
setWorkflowStageToTestAndResetPublishedDate ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event ) Resets the workflowstage to test and the published date to null.
setWorkflowStageToTestForCopy ( Sulu\Component\DocumentManager\Event\CopyEvent $event ) Sets the workflowstage for the copied node and all its children to test. This is done because newly copied pages shouldn't be automatically published on the website.

Private Methods

Method Description
setNodeWorkflowStageToTestForCopy ( PHPCR\NodeInterface $node ) Sets the workflowstage and the published date for the given node and all of its children to test resp. null. This is done for every language in which the given properties exist.
setWorkflowStage ( Sulu\Component\Content\Document\Behavior\WorkflowStageBehavior $document, Sulu\Component\DocumentManager\DocumentAccessor $accessor, string $workflowStage, string $locale, string $live ) Sets the workflow properties on the given document.
setWorkflowStageOnNode ( PHPCR\NodeInterface $node, string $locale, integer $workflowStage, boolean $updatePublished ) Sets the workflow stage properties on the given node.
supports ( Sulu\Component\DocumentManager\Event\HydrateEvent | Sulu\Component\DocumentManager\Event\PublishEvent | Sulu\Component\DocumentManager\Event\PersistEvent $event ) : boolean Determines if the given document is supported by this subscriber.

Method Details

__construct() public method

public __construct ( Sulu\Component\DocumentManager\PropertyEncoder $propertyEncoder, Sulu\Component\DocumentManager\DocumentInspector $documentInspector, PHPCR\SessionInterface $defaultSession, PHPCR\SessionInterface $liveSession )
$propertyEncoder Sulu\Component\DocumentManager\PropertyEncoder
$documentInspector Sulu\Component\DocumentManager\DocumentInspector
$defaultSession PHPCR\SessionInterface
$liveSession PHPCR\SessionInterface

getSubscribedEvents() public static method

public static getSubscribedEvents ( )

setWorkflowStageOnDocument() public method

Sets the workflow properties from the node on the document.
public setWorkflowStageOnDocument ( Sulu\Component\DocumentManager\Event\HydrateEvent $event )
$event Sulu\Component\DocumentManager\Event\HydrateEvent

setWorkflowStageToPublished() public method

Sets the workflow stage for the passed document to published.
public setWorkflowStageToPublished ( Sulu\Component\DocumentManager\Event\PublishEvent $event )
$event Sulu\Component\DocumentManager\Event\PublishEvent

setWorkflowStageToTest() public method

Sets the workflow stage for the passed document to test.
public setWorkflowStageToTest ( Sulu\Component\DocumentManager\Event\PersistEvent $event )
$event Sulu\Component\DocumentManager\Event\PersistEvent

setWorkflowStageToTestAndResetPublishedDate() public method

Resets the workflowstage to test and the published date to null.
public setWorkflowStageToTestAndResetPublishedDate ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event )
$event Sulu\Component\DocumentManager\Event\UnpublishEvent

setWorkflowStageToTestForCopy() public method

Sets the workflowstage for the copied node and all its children to test. This is done because newly copied pages shouldn't be automatically published on the website.
public setWorkflowStageToTestForCopy ( Sulu\Component\DocumentManager\Event\CopyEvent $event )
$event Sulu\Component\DocumentManager\Event\CopyEvent