Sets the workspace of this node.
public setWorkspace ( |
||
$workspace | ||
return | void |
/** * @test */ public function setWorkspacesAllowsForSettingTheWorkspaceForInternalPurposes() { /** @var Workspace|\PHPUnit_Framework_MockObject_MockObject $newWorkspace */ $newWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock(); $this->assertSame($this->mockWorkspace, $this->nodeData->getWorkspace()); $this->nodeData->setWorkspace($newWorkspace); $this->assertSame($newWorkspace, $this->nodeData->getWorkspace()); }
/** * Sets the workspace of this node. * * This method is only for internal use by the content repository. Changing * the workspace of a node manually may lead to unexpected behavior. * * @param Workspace $workspace * @return void */ public function setWorkspace(Workspace $workspace) { if (!$this->isNodeDataMatchingContext()) { $this->materializeNodeData(); } if ($this->getWorkspace()->getName() === $workspace->getName()) { return; } $this->nodeData->setWorkspace($workspace); $this->context->getFirstLevelNodeCache()->flush(); $this->emitNodeUpdated($this); }