本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Service\Context::getFirstLevelNodeCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getFirstLevelNodeCache方法的具体用法?PHP Context::getFirstLevelNodeCache怎么用?PHP Context::getFirstLevelNodeCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Service\Context
的用法示例。
在下文中一共展示了Context::getFirstLevelNodeCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createVariantForContext
/**
* Given a context a new node is returned that is like this node, but
* lives in the new context.
*
* @param Context $context
* @return NodeInterface
*/
public function createVariantForContext($context)
{
$autoCreatedChildNodes = array();
$nodeType = $this->getNodeType();
foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeConfiguration) {
$childNode = $this->getNode($childNodeName);
if ($childNode !== null) {
$autoCreatedChildNodes[$childNodeName] = $childNode;
}
}
$nodeData = new NodeData($this->nodeData->getPath(), $context->getWorkspace(), $this->nodeData->getIdentifier(), $context->getTargetDimensionValues());
$nodeData->similarize($this->nodeData);
if ($this->context !== $context) {
$node = $this->nodeFactory->createFromNodeData($nodeData, $context);
} else {
$this->setNodeData($nodeData);
$node = $this;
}
$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodeAdded($node);
/**
* @var $autoCreatedChildNode NodeInterface
*/
foreach ($autoCreatedChildNodes as $autoCreatedChildNode) {
$autoCreatedChildNode->createVariantForContext($context);
}
return $node;
}
示例2: createVariantForContext
/**
* Given a context a new node is returned that is like this node, but
* lives in the new context.
*
* @param \TYPO3\TYPO3CR\Domain\Service\Context $context
* @return NodeInterface
*/
public function createVariantForContext($context)
{
$nodeData = clone $this->nodeData;
$nodeData->adjustToContext($context);
$this->nodeDataRepository->add($nodeData);
$node = $this->nodeFactory->createFromNodeData($nodeData, $context);
$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodeAdded($node);
return $node;
}