PHP Class Neos\ContentRepository\Domain\Model\Workspace

ファイルを表示 Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$baseWorkspace Workspace Content from the base workspace will shine through in this workspace as long as they are not modified in this workspace.
$description string An optional user-defined description
$name string
$nodeDataRepository Neos\ContentRepository\Domain\Repository\NodeDataRepository
$nodeService Neos\ContentRepository\Domain\Service\NodeServiceInterface
$now Neos\Flow\Utility\Now
$owner string We can't use a real many-to-many relation here, because the User implementation will come from a different package (e.g. Neos) which ContentRepository does not depend on. This relation may be implemented with a target entity listener at a later stage, when we implemented support for it in Flow core. See also: http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/resolve-target-entity-listener.html
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$publishingService Neos\ContentRepository\Domain\Service\PublishingServiceInterface
$reflectionService Neos\Flow\Reflection\ReflectionService
$rootNodeData NodeData Root node data of this workspace
$title string A user-defined, human-friendly title for this workspace

Public Methods

Method Description
__construct ( string $name, Workspace $baseWorkspace = null, Neos\ContentRepository\Domain\Model\UserInterface $owner = null ) Constructs a new workspace
getBaseWorkspace ( ) : Workspace Returns the base workspace, if any
getBaseWorkspaces ( ) : Workspace[] Returns all base workspaces, if any
getDescription ( ) : string Returns the workspace description
getName ( ) : string Returns the name of this workspace
getNodeCount ( ) : integer Returns the number of nodes in this workspace.
getOwner ( ) : Neos\ContentRepository\Domain\Model\UserInterface Returns the workspace owner.
getRootNodeData ( ) : NodeData Returns the root node data of this workspace
getTitle ( ) : string Returns the workspace title
initializeObject ( integer $initializationCause ) : void Initializes this workspace.
isInternalWorkspace ( ) : boolean Checks if this workspace is shared across all editors
isPersonalWorkspace ( ) : boolean Checks if this workspace is a user's personal workspace
isPrivateWorkspace ( ) : boolean Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
isPublicWorkspace ( ) : boolean Checks if this workspace is public to everyone, even without authentication
publish ( Workspace $targetWorkspace ) : void Publishes the content of this workspace to another workspace.
publishNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void Publishes the given node to the target workspace.
publishNodes ( array $nodes, Workspace $targetWorkspace ) : void Publishes the given nodes to the target workspace.
setBaseWorkspace ( Workspace $baseWorkspace ) : void Sets the base workspace
setDescription ( string $description ) : void Sets the workspace description
setOwner ( Neos\ContentRepository\Domain\Model\UserInterface | string $user ) Returns the workspace owner.
setTitle ( string $title ) : void Sets workspace title

Protected Methods

Method Description
adjustShadowNodeData ( NodeData $shadowNodeData, NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData ) : void Adjust the given $shadowNodeData by removing it or moving it to the $targetWorkspace, as needed.
adjustShadowNodePath ( NodeData $shadowNodeData, $path, Workspace $targetWorkspace, array $dimensionValues ) : void Adjusts the path of $shadowNodeData to $path, if needed/possible.
emitAfterNodePublishing ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void Emits a signal when a node has been published.
emitBaseWorkspaceChanged ( Workspace $workspace, Workspace $oldBaseWorkspace = null, Workspace $newBaseWorkspace = null ) : void Emits a signal after the base workspace has been changed
emitBeforeNodePublishing ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void Emits a signal just before a node is being published
findNodeDataInTargetWorkspace ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : NodeData Returns the NodeData instance with the given identifier from the target workspace.
handleShadowNodeData ( NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData ) : boolean Look for a shadow node of $publishedNodeData either adjust or remove it based on $targetWorkspace if the shadow node is marked as removed.
moveNodeVariantToTargetWorkspace ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void Move the given node instance to the target workspace
replaceNodeData ( Neos\ContentRepository\Domain\Model\NodeInterface $node, NodeData $targetNodeData ) : void Replace the node data of a node instance with a given target node data
verifyPublishingTargetWorkspace ( Workspace $targetWorkspace ) : void Checks if the specified workspace is a base workspace of this workspace and if not, throws an exception

Method Details

__construct() public method

Constructs a new workspace
public __construct ( string $name, Workspace $baseWorkspace = null, Neos\ContentRepository\Domain\Model\UserInterface $owner = null )
$name string Name of this workspace
$baseWorkspace Workspace A workspace this workspace is based on (if any)
$owner Neos\ContentRepository\Domain\Model\UserInterface The user that created the workspace (if any, "system" workspaces have none)

adjustShadowNodeData() protected method

Adjust the given $shadowNodeData by removing it or moving it to the $targetWorkspace, as needed.
protected adjustShadowNodeData ( NodeData $shadowNodeData, NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData ) : void
$shadowNodeData NodeData
$publishedNodeData NodeData
$targetWorkspace Workspace
$targetNodeData NodeData
return void

adjustShadowNodePath() protected method

If the $path is occupied in $targetWorkspace, the shadow is removed.
protected adjustShadowNodePath ( NodeData $shadowNodeData, $path, Workspace $targetWorkspace, array $dimensionValues ) : void
$shadowNodeData NodeData
$path
$targetWorkspace Workspace
$dimensionValues array
return void

emitAfterNodePublishing() protected method

The signal emits the source node and target workspace, i.e. the node contains its source workspace.
protected emitAfterNodePublishing ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node that was published
$targetWorkspace Workspace The publishing target workspace
return void

emitBaseWorkspaceChanged() protected method

Emits a signal after the base workspace has been changed
protected emitBaseWorkspaceChanged ( Workspace $workspace, Workspace $oldBaseWorkspace = null, Workspace $newBaseWorkspace = null ) : void
$workspace Workspace This workspace
$oldBaseWorkspace Workspace The workspace which was the base workspace before the change
$newBaseWorkspace Workspace The new base workspace
return void

emitBeforeNodePublishing() protected method

The signal emits the source node and target workspace, i.e. the node contains its source workspace.
protected emitBeforeNodePublishing ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node to be published
$targetWorkspace Workspace The publishing target workspace
return void

findNodeDataInTargetWorkspace() protected method

If no NodeData instance is found, null is returned.
protected findNodeDataInTargetWorkspace ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : NodeData
$node Neos\ContentRepository\Domain\Model\NodeInterface
$targetWorkspace Workspace
return NodeData

getBaseWorkspace() public method

Returns the base workspace, if any
public getBaseWorkspace ( ) : Workspace
return Workspace

getBaseWorkspaces() public method

Returns all base workspaces, if any
public getBaseWorkspaces ( ) : Workspace[]
return Workspace[]

getDescription() public method

Returns the workspace description
public getDescription ( ) : string
return string

getName() public method

Returns the name of this workspace
public getName ( ) : string
return string Name of this workspace

getNodeCount() public method

If $includeBaseWorkspaces is enabled, also nodes of base workspaces are taken into account. If it is disabled (default) then the number of nodes is the actual number (+1) of changes related to its base workspaces. A node count of 1 means that no changes are pending in this workspace because a workspace always contains at least its Root Node.
public getNodeCount ( ) : integer
return integer

getOwner() public method

Returns the workspace owner.
public getOwner ( ) : Neos\ContentRepository\Domain\Model\UserInterface
return Neos\ContentRepository\Domain\Model\UserInterface

getRootNodeData() public method

Returns the root node data of this workspace
public getRootNodeData ( ) : NodeData
return NodeData

getTitle() public method

Returns the workspace title
public getTitle ( ) : string
return string

handleShadowNodeData() protected method

Look for a shadow node of $publishedNodeData either adjust or remove it based on $targetWorkspace if the shadow node is marked as removed.
protected handleShadowNodeData ( NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData ) : boolean
$publishedNodeData NodeData
$targetWorkspace Workspace
$targetNodeData NodeData
return boolean false if no shadow node was found, true otherwise

initializeObject() public method

If this workspace is brand new, a root node is created automatically.
public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
return void

isInternalWorkspace() public method

Checks if this workspace is shared across all editors
public isInternalWorkspace ( ) : boolean
return boolean

isPersonalWorkspace() public method

Checks if this workspace is a user's personal workspace
public isPersonalWorkspace ( ) : boolean
return boolean

isPrivateWorkspace() public method

Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
public isPrivateWorkspace ( ) : boolean
return boolean

isPublicWorkspace() public method

Checks if this workspace is public to everyone, even without authentication
public isPublicWorkspace ( ) : boolean
return boolean

moveNodeVariantToTargetWorkspace() protected method

If no target node variant (having the same dimension values) exists in the target workspace, the node that is published will be used as a new node variant in the target workspace.
protected moveNodeVariantToTargetWorkspace ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node to publish
$targetWorkspace Workspace The workspace to publish to
return void

publish() public method

The specified workspace must be a base workspace of this workspace.
public publish ( Workspace $targetWorkspace ) : void
$targetWorkspace Workspace The workspace to publish to
return void

publishNode() public method

The specified workspace must be a base workspace of this workspace.
public publishNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Workspace $targetWorkspace ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node to publish
$targetWorkspace Workspace The workspace to publish to
return void

publishNodes() public method

The specified workspace must be a base workspace of this workspace.
public publishNodes ( array $nodes, Workspace $targetWorkspace ) : void
$nodes array
$targetWorkspace Workspace The workspace to publish to
return void

replaceNodeData() protected method

The node data of the node that is published will be removed and the existing node data inside the target workspace is updated to the changes and will be injected into the node instance. If the node was marked as removed, both node data are removed.
protected replaceNodeData ( Neos\ContentRepository\Domain\Model\NodeInterface $node, NodeData $targetNodeData ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node instance with node data to be published
$targetNodeData NodeData The existing node data in the target workspace
return void

setBaseWorkspace() public method

Note that this method is not part of the public API because further action is necessary for rebasing a workspace
public setBaseWorkspace ( Workspace $baseWorkspace ) : void
$baseWorkspace Workspace
return void

setDescription() public method

Sets the workspace description
public setDescription ( string $description ) : void
$description string
return void

setOwner() public method

Returns the workspace owner.
public setOwner ( Neos\ContentRepository\Domain\Model\UserInterface | string $user )
$user Neos\ContentRepository\Domain\Model\UserInterface | string The new user, or user's UUID

setTitle() public method

Sets workspace title
public setTitle ( string $title ) : void
$title string
return void

verifyPublishingTargetWorkspace() protected method

Checks if the specified workspace is a base workspace of this workspace and if not, throws an exception
protected verifyPublishingTargetWorkspace ( Workspace $targetWorkspace ) : void
$targetWorkspace Workspace The publishing target workspace
return void

Property Details

$baseWorkspace protected_oe property

Content from the base workspace will shine through in this workspace as long as they are not modified in this workspace.
protected Workspace,Neos\ContentRepository\Domain\Model $baseWorkspace
return Workspace

$description protected_oe property

An optional user-defined description
protected string $description
return string

$name protected_oe property

protected string $name
return string

$nodeDataRepository protected_oe property

protected NodeDataRepository,Neos\ContentRepository\Domain\Repository $nodeDataRepository
return Neos\ContentRepository\Domain\Repository\NodeDataRepository

$nodeService protected_oe property

protected NodeServiceInterface,Neos\ContentRepository\Domain\Service $nodeService
return Neos\ContentRepository\Domain\Service\NodeServiceInterface

$now protected_oe property

protected Now,Neos\Flow\Utility $now
return Neos\Flow\Utility\Now

$owner protected_oe property

We can't use a real many-to-many relation here, because the User implementation will come from a different package (e.g. Neos) which ContentRepository does not depend on. This relation may be implemented with a target entity listener at a later stage, when we implemented support for it in Flow core. See also: http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/resolve-target-entity-listener.html
protected string $owner
return string

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$publishingService protected_oe property

protected PublishingServiceInterface,Neos\ContentRepository\Domain\Service $publishingService
return Neos\ContentRepository\Domain\Service\PublishingServiceInterface

$reflectionService protected_oe property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService

$rootNodeData protected_oe property

Root node data of this workspace
protected NodeData,Neos\ContentRepository\Domain\Model $rootNodeData
return NodeData

$title protected_oe property

A user-defined, human-friendly title for this workspace
protected string $title
return string