Workspace
class Workspace (View source)
A Workspace
Constants
PERSONAL_WORKSPACE_PREFIX |
This prefix determines if a given workspace (name) is a user workspace. |
Properties
protected string | $name | ||
protected string | $title | A user-defined, human-friendly title for this workspace |
|
protected string | $description | An optional user-defined description |
|
protected string | $owner | This property contains a UUID of the User object which is the owner of this workspace. |
|
protected Workspace | $baseWorkspace | Workspace (if any) this workspace is based on. |
|
protected NodeData | $rootNodeData | Root node data of this workspace |
|
protected NodeDataRepository | $nodeDataRepository | ||
protected PublishingServiceInterface | $publishingService | ||
protected NodeServiceInterface | $nodeService | ||
protected Now | $now | ||
protected ReflectionService | $reflectionService | ||
protected PersistenceManagerInterface | $persistenceManager |
Methods
Constructs a new workspace
Initializes this workspace.
Returns the name of this workspace
Returns the workspace title
Sets workspace title
Returns the workspace description
Sets the workspace description
Returns the workspace owner.
Checks if this workspace is a user's personal workspace
Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
Checks if this workspace is shared across all editors
Checks if this workspace is public to everyone, even without authentication
Returns the base workspace, if any
Returns all base workspaces, if any
Returns the root node data of this workspace
Publishes the given nodes to the target workspace.
Publishes the given node to the target workspace.
Checks if the given node can / needs to be published to the given target workspace or if that operation can be skipped.
Replace the node data of a node instance with a given target node data
Moves variants of a given node which exists in other workspaces than source and target workspace.
Moves an existing node in a target workspace to the place it should be in after publish, in order to move all children to the new position as well.
Move the given node instance to the target workspace
Adjusts related shadow nodes for a "publish node" operation.
Returns the number of nodes in this workspace.
Checks if the specified workspace is a base workspace of this workspace and if not, throws an exception
Returns the NodeData instance with the given identifier from the target workspace.
Emits a signal after the base workspace has been changed
Emits a signal just before a node is being published
Emits a signal when a node has been published.
Details
__construct(string $name, Workspace $baseWorkspace = null, UserInterface $owner = null)
Constructs a new workspace
void
initializeObject(int $initializationCause)
Initializes this workspace.
If this workspace is brand new, a root node is created automatically.
string
getName()
Returns the name of this workspace
string
getTitle()
Returns the workspace title
void
setTitle(string $title)
Sets workspace title
string|null
getDescription()
Returns the workspace description
void
setDescription(string $description)
Sets the workspace description
UserInterface|null
getOwner()
Returns the workspace owner.
void
setOwner(UserInterface|string|null $user)
Returns the workspace owner.
bool
isPersonalWorkspace()
Checks if this workspace is a user's personal workspace
bool
isPrivateWorkspace()
Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
bool
isInternalWorkspace()
Checks if this workspace is shared across all editors
bool
isPublicWorkspace()
Checks if this workspace is public to everyone, even without authentication
void
setBaseWorkspace(Workspace $baseWorkspace)
Sets the base workspace
Note that this method is not part of the public API because further action is necessary for rebasing a workspace
Workspace|null
getBaseWorkspace()
Returns the base workspace, if any
array
getBaseWorkspaces()
Returns all base workspaces, if any
NodeData
getRootNodeData()
Returns the root node data of this workspace
void
publish(Workspace $targetWorkspace)
Publishes the content of this workspace to another workspace.
The specified workspace must be a base workspace of this workspace.
void
publishNodes(array $nodes, Workspace $targetWorkspace)
Publishes the given nodes to the target workspace.
The specified workspace must be a base workspace of this workspace.
void
publishNode(NodeInterface $nodeToPublish, Workspace $targetWorkspace)
Publishes the given node to the target workspace.
The specified workspace must be a base workspace of this workspace.
protected bool
publishNodeCanBeSkipped(NodeInterface $node, Workspace $targetWorkspace)
Checks if the given node can / needs to be published to the given target workspace or if that operation can be skipped.
protected void
replaceNodeData(NodeInterface $sourceNode, NodeData $targetNodeData)
Replace the node data of a node instance with a given target node data
The current node data of $node will be removed and be replaced by $targetNodeData. If $node was marked as removed, both node data instances are removed.
protected void
moveNodeVariantsInOtherWorkspaces(string $nodeIdentifier, string $targetPath, Workspace $sourceWorkspace, Workspace $targetWorkspace)
Moves variants of a given node which exists in other workspaces than source and target workspace.
protected NodeData
moveTargetNodeDataToNewPosition(NodeData $targetNodeData, string $destinationPath)
Moves an existing node in a target workspace to the place it should be in after publish, in order to move all children to the new position as well.
protected void
moveNodeVariantToTargetWorkspace(NodeInterface $nodeToPublish, Workspace $targetWorkspace)
Move the given node instance to the target workspace
If no target node variant (having the same dimension values) exists in the target workspace, the node that is published will be re-used as a new node variant in the target workspace.
protected void
adjustShadowNodeDataForNodePublishing(NodeData $sourceNodeData, Workspace $targetWorkspace, NodeData $targetNodeData)
Adjusts related shadow nodes for a "publish node" operation.
This method will look for a shadow node of $sourceNodeData. That shadow node will either be adjusted or, if the target node in the given target workspace is marked as removed, remove it.
int
getNodeCount()
Returns the number of nodes in this workspace.
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.
protected void
verifyPublishingTargetWorkspace(Workspace $targetWorkspace)
Checks if the specified workspace is a base workspace of this workspace and if not, throws an exception
protected NodeData|null
findCorrespondingNodeDataInTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace)
Returns the NodeData instance with the given identifier from the target workspace.
If no NodeData instance is found in that target workspace, null is returned.
protected void
emitBaseWorkspaceChanged(Workspace $workspace, Workspace $oldBaseWorkspace = null, Workspace $newBaseWorkspace = null)
Emits a signal after the base workspace has been changed
protected void
emitBeforeNodePublishing(NodeInterface $node, Workspace $targetWorkspace)
Emits a signal just before a node is being published
The signal emits the source node and target workspace, i.e. the node contains its source workspace.
protected void
emitAfterNodePublishing(NodeInterface $node, Workspace $targetWorkspace)
Emits a signal when a node has been published.
The signal emits the source node and target workspace, i.e. the node contains its source workspace.