PHP Class Sulu\Bundle\ContentBundle\Document\Subscriber\PublishSubscriber

Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
显示文件 Open project: sulu/sulu

Public Methods

Method Description
__construct ( PHPCR\SessionInterface $liveSession, Sulu\Component\DocumentManager\NodeHelperInterface $nodeHelper, PropertyEncoder $propertyEncoder )
copyNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\CopyEvent $event ) If a node is copied a node with the same UUID will be created in the live session.
copyPropertiesFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\RemoveDraftEvent $event )
createNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\PersistEvent $event ) Creates the node with the same UUID in the public workspace if it does not exist yet. In case it does it will be renamed if necessary.
flushPublicWorkspace ( ) Flushes the live session.
getSubscribedEvents ( )
moveNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\MoveEvent $event ) Since moving is not draftable the node will also be moved in the live session immediately.
removeNodeFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\RemoveEvent $event ) Since deleting is not draftable the node will be deleted in the live session as soon as it is deleted in the default session.
removePropertiesFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event ) Removes all the properties for the given locale from the node, so that the content is not accessible anymore from the live workspace.
reorderNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\ReorderEvent $event ) Reordering is also not draftable, and therefore also immediately applied to the live session.
setNodeFromPublicWorkspaceForPublishing ( Sulu\Component\DocumentManager\Event\PublishEvent $event ) Sets the correct node from the live session for the PublishEvent.
setNodeFromPublicWorkspaceForUnpublishing ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event ) Sets the correct node from the live session for the UnpublishEvent.

Private Methods

Method Description
copyNodeWithChildrenInPublicWorkspace ( PHPCR\NodeInterface $node )
createNodesWithUuid ( PHPCR\NodeInterface $node ) Creates every node on the path to the given node. Also uses the same UUIDs for these nodes.
getLiveNode ( Sulu\Component\DocumentManager\Behavior\Mapping\PathBehavior $document ) : PHPCR\NodeInterface Returns the live node for given document.
removeLocalizedNodeProperties ( PHPCR\NodeInterface $node, string $locale ) Removes all localized properties in the given locale from the given node.
setNodeFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\PublishEvent | Sulu\Component\DocumentManager\Event\UnpublishEvent $event ) Sets the node from the live workspace on the given event.

Method Details

__construct() public method

public __construct ( PHPCR\SessionInterface $liveSession, Sulu\Component\DocumentManager\NodeHelperInterface $nodeHelper, PropertyEncoder $propertyEncoder )
$liveSession PHPCR\SessionInterface
$nodeHelper Sulu\Component\DocumentManager\NodeHelperInterface
$propertyEncoder Sulu\Bundle\DocumentManagerBundle\Bridge\PropertyEncoder

copyNodeInPublicWorkspace() public method

If a node is copied a node with the same UUID will be created in the live session.
public copyNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\CopyEvent $event )
$event Sulu\Component\DocumentManager\Event\CopyEvent

copyPropertiesFromPublicWorkspace() public method

public copyPropertiesFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\RemoveDraftEvent $event )
$event Sulu\Component\DocumentManager\Event\RemoveDraftEvent

createNodeInPublicWorkspace() public method

Creates the node with the same UUID in the public workspace if it does not exist yet. In case it does it will be renamed if necessary.
public createNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\PersistEvent $event )
$event Sulu\Component\DocumentManager\Event\PersistEvent

flushPublicWorkspace() public method

Flushes the live session.

getSubscribedEvents() public static method

public static getSubscribedEvents ( )

moveNodeInPublicWorkspace() public method

Since moving is not draftable the node will also be moved in the live session immediately.
public moveNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\MoveEvent $event )
$event Sulu\Component\DocumentManager\Event\MoveEvent

removeNodeFromPublicWorkspace() public method

Since deleting is not draftable the node will be deleted in the live session as soon as it is deleted in the default session.
public removeNodeFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\RemoveEvent $event )
$event Sulu\Component\DocumentManager\Event\RemoveEvent

removePropertiesFromPublicWorkspace() public method

Removes all the properties for the given locale from the node, so that the content is not accessible anymore from the live workspace.
public removePropertiesFromPublicWorkspace ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event )
$event Sulu\Component\DocumentManager\Event\UnpublishEvent

reorderNodeInPublicWorkspace() public method

Reordering is also not draftable, and therefore also immediately applied to the live session.
public reorderNodeInPublicWorkspace ( Sulu\Component\DocumentManager\Event\ReorderEvent $event )
$event Sulu\Component\DocumentManager\Event\ReorderEvent

setNodeFromPublicWorkspaceForPublishing() public method

Sets the correct node from the live session for the PublishEvent.
public setNodeFromPublicWorkspaceForPublishing ( Sulu\Component\DocumentManager\Event\PublishEvent $event )
$event Sulu\Component\DocumentManager\Event\PublishEvent

setNodeFromPublicWorkspaceForUnpublishing() public method

Sets the correct node from the live session for the UnpublishEvent.
public setNodeFromPublicWorkspaceForUnpublishing ( Sulu\Component\DocumentManager\Event\UnpublishEvent $event )
$event Sulu\Component\DocumentManager\Event\UnpublishEvent