本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::similarize方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::similarize方法的具体用法?PHP NodeData::similarize怎么用?PHP NodeData::similarize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::similarize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: similarizeClearsPropertiesBeforeAddingNewOnes
/**
* @test
*/
public function similarizeClearsPropertiesBeforeAddingNewOnes()
{
/** @var $sourceNode NodeData */
$sourceNode = $this->getAccessibleMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array('addOrUpdate'), array('/foo/bar', $this->mockWorkspace));
$this->inject($sourceNode, 'nodeTypeManager', $this->mockNodeTypeManager);
$sourceNode->_set('nodeDataRepository', $this->createMock('TYPO3\\Flow\\Persistence\\RepositoryInterface'));
$this->nodeData->setProperty('someProperty', 'somePropertyValue');
$this->nodeData->setProperty('someOtherProperty', 'someOtherPropertyValue');
$sourceNode->setProperty('newProperty', 'newPropertyValue');
$sourceNode->setProperty('someProperty', 'someOverriddenPropertyValue');
$this->nodeData->similarize($sourceNode);
$expectedProperties = array('newProperty' => 'newPropertyValue', 'someProperty' => 'someOverriddenPropertyValue');
$this->assertEquals($expectedProperties, $this->nodeData->getProperties());
}
示例2: similarize
/**
* For internal use in createRecursiveCopy.
*
* @param NodeInterface $sourceNode
* @return void
*/
public function similarize(NodeInterface $sourceNode)
{
$this->nodeData->similarize($sourceNode->getNodeData());
}
示例3: createShadow
/**
* Create a shadow NodeData at the given path with the same workspace and dimensions as this
*
* Note: The constructor will already add the new object to the repository
*
* @param string $path The (original) path for the node data
* @return NodeData
*/
public function createShadow($path)
{
$shadowNode = new NodeData($path, $this->workspace, $this->identifier, $this->dimensionValues);
$shadowNode->similarize($this);
$shadowNode->setAsShadowOf($this);
return $shadowNode;
}
示例4: 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;
}