本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::createSingleNodeData方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::createSingleNodeData方法的具体用法?PHP NodeData::createSingleNodeData怎么用?PHP NodeData::createSingleNodeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::createSingleNodeData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSingleNode
/**
* Creates, adds and returns a child node of this node, without setting default
* properties or creating subnodes. Only used internally.
*
* For internal use only!
* TODO: New SiteImportService uses createNode() and DQL. When we drop the LegagcySiteImportService we can change this to protected.
*
* @param string $name Name of the new node
* @param NodeType $nodeType Node type of the new node (optional)
* @param string $identifier The identifier of the node, unique within the workspace, optional(!)
* @return Node
* @throws NodeConstraintException
*/
public function createSingleNode($name, NodeType $nodeType = null, $identifier = null)
{
if ($nodeType !== null && !$this->willChildNodeBeAutoCreated($name) && !$this->isNodeTypeAllowedAsChildNode($nodeType)) {
throw new NodeConstraintException('Cannot create new node "' . $name . '" of Type "' . $nodeType->getName() . '" in ' . $this->__toString(), 1400782413);
}
$dimensions = $this->context->getTargetDimensionValues();
$nodeData = $this->nodeData->createSingleNodeData($name, $nodeType, $identifier, $this->context->getWorkspace(), $dimensions);
$node = $this->nodeFactory->createFromNodeData($nodeData, $this->context);
$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodeAdded($node);
return $node;
}
示例2: createSingleNode
/**
* Creates, adds and returns a child node of this node, without setting default
* properties or creating subnodes. Only used internally.
*
* For internal use only!
* TODO: Check if we can change the import service to avoid making this public.
*
* @param string $name Name of the new node
* @param \TYPO3\TYPO3CR\Domain\Model\NodeType $nodeType Node type of the new node (optional)
* @param string $identifier The identifier of the node, unique within the workspace, optional(!)
* @param array $dimensions Content dimension values to set on the node (Array of dimension names to array of values)
* @return \TYPO3\TYPO3CR\Domain\Model\Node
*/
public function createSingleNode($name, NodeType $nodeType = NULL, $identifier = NULL, array $dimensions = NULL)
{
if ($dimensions === NULL || $dimensions === array()) {
$targetDimensions = $this->context->getTargetDimensions();
$dimensions = array_map(function ($value) {
return array($value);
}, $targetDimensions);
}
$nodeData = $this->nodeData->createSingleNodeData($name, $nodeType, $identifier, $this->context->getWorkspace(), $dimensions);
$node = $this->nodeFactory->createFromNodeData($nodeData, $this->context);
$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodeAdded($node);
return $node;
}