本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeInterface::setNodeData方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::setNodeData方法的具体用法?PHP NodeInterface::setNodeData怎么用?PHP NodeInterface::setNodeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::setNodeData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceNodeData
/**
* Replace the node data of a node instance with a given target node data
*
* 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.
*
* @param NodeInterface $node The node instance with node data to be published
* @param NodeData $targetNodeData The existing node data in the target workspace
* @return void
*/
protected function replaceNodeData(NodeInterface $node, NodeData $targetNodeData)
{
$sourceNodeData = $node->getNodeData();
$nodeWasMoved = false;
$movedShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($sourceNodeData);
if ($movedShadowNodeData instanceof NodeData) {
$nodeWasMoved = true;
if ($movedShadowNodeData->isRemoved()) {
$this->nodeDataRepository->remove($movedShadowNodeData);
}
}
if ($node->isRemoved() === true) {
$this->nodeDataRepository->remove($targetNodeData);
} else {
$targetNodeData->similarize($node->getNodeData());
if ($nodeWasMoved) {
$targetNodeData->setPath($node->getPath(), false);
}
$targetNodeData->setLastPublicationDateTime($this->now);
$node->setNodeData($targetNodeData);
$this->nodeService->cleanUpProperties($node);
}
$this->nodeDataRepository->remove($sourceNodeData);
}
示例2: moveNodeToDestinationPath
/**
* Moves the given node to the destination path by modifying the underlaying NodeData object.
*
* @param NodeInterface $node
* @param string $destinationPath
* @return void
*/
protected function moveNodeToDestinationPath(NodeInterface $node, $destinationPath)
{
$nodeData = $node->getNodeData();
$possibleShadowedNodeData = $nodeData->move($destinationPath, $this->context->getWorkspace());
$node->setNodeData($possibleShadowedNodeData);
}
示例3: replaceNodeData
/**
* Replace the node data of a node instance with a given target node data
*
* 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.
*
* @param NodeInterface $node The node instance with node data to be published
* @param NodeData $targetNodeData The existing node data in the target workspace
* @return void
*/
protected function replaceNodeData(NodeInterface $node, NodeData $targetNodeData)
{
$sourceNodeData = $node->getNodeData();
$nodeWasMoved = $this->handleShadowNodeData($sourceNodeData, $targetNodeData->getWorkspace(), $targetNodeData);
// Technically this shouldn't be needed but due to doctrines behavior we need it.
if ($sourceNodeData->isRemoved() && $targetNodeData->getWorkspace()->getBaseWorkspace() === null) {
$this->nodeDataRepository->remove($targetNodeData);
$this->nodeDataRepository->remove($sourceNodeData);
return;
}
$targetNodeData->similarize($sourceNodeData);
$targetNodeData->setLastPublicationDateTime($this->now);
if ($nodeWasMoved) {
// TODO: This seems wrong and introduces a publish order between nodes. We should always set the path.
$targetNodeData->setPath($node->getPath(), false);
}
$node->setNodeData($targetNodeData);
$this->nodeService->cleanUpProperties($node);
$targetNodeData->setRemoved($sourceNodeData->isRemoved());
$this->nodeDataRepository->remove($sourceNodeData);
}
示例4: replaceNodeData
/**
* Replace the node data of a node instance with a given target node data
*
* 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.
*
* @param NodeInterface $node The node instance with node data to be published
* @param NodeData $targetNodeData The existing node data in the target workspace
* @return void
*/
protected function replaceNodeData(NodeInterface $node, NodeData $targetNodeData)
{
$sourceNodeData = $node->getNodeData();
if ($node->isRemoved() === TRUE) {
$this->nodeDataRepository->remove($targetNodeData);
} else {
$targetNodeData->similarize($node->getNodeData());
$targetNodeData->setPath($node->getPath(), FALSE);
$node->setNodeData($targetNodeData);
}
$this->nodeDataRepository->remove($sourceNodeData);
}