本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::findOneByMovedTo方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDataRepository::findOneByMovedTo方法的具体用法?PHP NodeDataRepository::findOneByMovedTo怎么用?PHP NodeDataRepository::findOneByMovedTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository
的用法示例。
在下文中一共展示了NodeDataRepository::findOneByMovedTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDiscardNode
/**
* Method which does the actual work of discarding, includes a protection against endless recursions and
* multiple discarding of the same node.
*
* @param NodeInterface $node The node to discard
* @param array &$alreadyDiscardedNodeIdentifiers List of node identifiers which already have been discarded during one discardNode() run
* @return void
* @throws \TYPO3\TYPO3CR\Exception\WorkspaceException
*/
protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = [])
{
if ($node->getWorkspace()->getBaseWorkspace() === null) {
throw new WorkspaceException('Nodes in a in a workspace without a base workspace cannot be discarded.', 1395841899);
}
if ($node->getPath() === '/') {
return;
}
if (array_search($node->getIdentifier(), $alreadyDiscardedNodeIdentifiers) !== false) {
return;
}
$alreadyDiscardedNodeIdentifiers[] = $node->getIdentifier();
$possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData());
if ($possibleShadowNodeData instanceof NodeData) {
if ($possibleShadowNodeData->getMovedTo() !== null) {
$parentBasePath = $node->getPath();
$affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true);
foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) {
/** @var NodeData $affectedChildNodeData */
$affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext());
$this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers);
}
}
$this->nodeDataRepository->remove($possibleShadowNodeData);
}
$this->nodeDataRepository->remove($node);
$this->emitNodeDiscarded($node);
}
示例2: discardNode
/**
* Discards the given node.
*
* @param NodeInterface $node
* @return void
* @throws \TYPO3\TYPO3CR\Exception\WorkspaceException
* @api
*/
public function discardNode(NodeInterface $node)
{
if ($node->getWorkspace()->getBaseWorkspace() === NULL) {
throw new WorkspaceException('Nodes in a in a workspace without a base workspace cannot be discarded.', 1395841899);
}
$possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData());
if ($possibleShadowNodeData !== NULL) {
$this->nodeDataRepository->remove($possibleShadowNodeData);
}
if ($node->getPath() !== '/') {
$this->nodeDataRepository->remove($node);
$this->emitNodeDiscarded($node);
}
}
示例3: moveNodeVariantToTargetWorkspace
/**
* 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 used as a new node variant in the target workspace.
*
* @param NodeInterface $node The node to publish
* @param Workspace $targetWorkspace The workspace to publish to
* @return void
*/
protected function moveNodeVariantToTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace)
{
$nodeData = $node->getNodeData();
$movedShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($nodeData);
if ($movedShadowNodeData instanceof NodeData && $movedShadowNodeData->isRemoved()) {
$this->nodeDataRepository->remove($movedShadowNodeData);
}
if ($targetWorkspace->getBaseWorkspace() === null && $node->isRemoved()) {
$this->nodeDataRepository->remove($nodeData);
} else {
$nodeData->setWorkspace($targetWorkspace);
$nodeData->setLastPublicationDateTime($this->now);
$this->nodeService->cleanUpProperties($node);
}
$node->setNodeDataIsMatchingContext(null);
}
示例4: handleShadowNodeData
/**
* Look for a shadow node of $publishedNodeData either adjust or remove it based on $targetWorkspace if the shadow
* node is marked as removed.
*
* @param NodeData $publishedNodeData
* @param Workspace $targetWorkspace
* @param NodeData $targetNodeData
* @return boolean false if no shadow node was found, true otherwise
*/
protected function handleShadowNodeData(NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData)
{
/** @var NodeData $shadowNodeData */
$shadowNodeData = $this->nodeDataRepository->findOneByMovedTo($publishedNodeData);
if ($shadowNodeData === null) {
return false;
}
// Technically this is not a shadow node
if ($shadowNodeData->isRemoved() === false) {
return true;
}
$targetWorkspaceBase = $targetWorkspace->getBaseWorkspace();
if ($targetWorkspaceBase !== null) {
$this->adjustShadowNodeData($shadowNodeData, $publishedNodeData, $targetWorkspace, $targetNodeData);
} else {
$this->nodeDataRepository->remove($shadowNodeData);
}
return true;
}