当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeDataRepository::add方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::add方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDataRepository::add方法的具体用法?PHP NodeDataRepository::add怎么用?PHP NodeDataRepository::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository的用法示例。


在下文中一共展示了NodeDataRepository::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeObject

 /**
  * Initializes this workspace.
  *
  * If this workspace is brand new, a root node is created automatically.
  *
  * @param integer $initializationCause
  * @return void
  */
 public function initializeObject($initializationCause)
 {
     if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
         $this->rootNodeData = new NodeData('/', $this);
         $this->nodeDataRepository->add($this->rootNodeData);
     }
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:15,代码来源:Workspace.php

示例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;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:17,代码来源:Node.php

示例3: findByParentAndNodeTypeIncludesAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions

 /**
  * @test
  */
 public function findByParentAndNodeTypeIncludesAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
 {
     $liveWorkspace = new Workspace('live');
     $nodeData = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData')->disableOriginalConstructor()->getMock();
     $nodeData->expects($this->any())->method('getIdentifier')->will($this->returnValue('abcd-efgh-ijkl-mnop'));
     $nodeData->expects($this->any())->method('getPath')->will($this->returnValue('/foo/bar'));
     $nodeData->expects($this->any())->method('getDepth')->will($this->returnValue(2));
     $this->nodeDataRepository->add($nodeData);
     $dimensions = array('persona' => array('everybody'), 'language' => array('de_DE', 'mul_ZZ'));
     $nodeData->expects($this->atLeastOnce())->method('matchesWorkspaceAndDimensions')->with($liveWorkspace, $dimensions)->will($this->returnValue(TRUE));
     $this->nodeDataRepository->expects($this->any())->method('getNodeDataForParentAndNodeType')->will($this->returnValue(array()));
     $result = $this->nodeDataRepository->findByParentAndNodeType('/foo', NULL, $liveWorkspace, $dimensions);
     $this->assertCount(1, $result);
     $fetchedNodeData = reset($result);
     $this->assertSame($nodeData, $fetchedNodeData);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:19,代码来源:NodeDataRepositoryTest.php

示例4: materializeNodeData

 /**
  * Materializes the original node data (of a different workspace) into the current
  * workspace.
  *
  * @return void
  */
 protected function materializeNodeData()
 {
     $dimensions = $this->context->getTargetDimensionValues();
     $newNodeData = new NodeData($this->nodeData->getPath(), $this->context->getWorkspace(), $this->nodeData->getIdentifier(), $dimensions);
     $this->nodeDataRepository->add($newNodeData);
     $newNodeData->similarize($this->nodeData);
     $this->nodeData = $newNodeData;
     $this->nodeDataIsMatchingContext = true;
     $nodeType = $this->getNodeType();
     foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeConfiguration) {
         $childNode = $this->getNode($childNodeName);
         if ($childNode instanceof Node && !$childNode->isNodeDataMatchingContext()) {
             $childNode->materializeNodeData();
         }
     }
 }
开发者ID:rderidder,项目名称:neos-development-collection,代码行数:22,代码来源:Node.php

示例5: createSingleNodeData

 /**
  * Creates, adds and returns a child node of this node, without setting default
  * properties or creating subnodes.
  *
  * @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 \TYPO3\TYPO3CR\Domain\Model\Workspace $workspace
  * @param array $dimensions An array of dimension name to dimension values
  * @throws NodeExistsException if a node with this path already exists.
  * @throws \InvalidArgumentException if the node name is not accepted.
  * @return \TYPO3\TYPO3CR\Domain\Model\NodeData
  */
 public function createSingleNodeData($name, NodeType $nodeType = NULL, $identifier = NULL, Workspace $workspace = NULL, array $dimensions = NULL)
 {
     if (!is_string($name) || preg_match(NodeInterface::MATCH_PATTERN_NAME, $name) !== 1) {
         throw new \InvalidArgumentException('Invalid node name "' . $name . '" (a node name must only contain characters, numbers and the "-" sign).', 1292428697);
     }
     $nodeWorkspace = $workspace ?: $this->workspace;
     $newPath = $this->path . ($this->path === '/' ? '' : '/') . $name;
     if ($this->nodeDataRepository->findOneByPath($newPath, $nodeWorkspace, $dimensions) !== NULL) {
         throw new NodeExistsException(sprintf('Node with path "' . $newPath . '" already exists in workspace %s and given dimensions %s.', $nodeWorkspace->getName(), var_export($dimensions, TRUE)), 1292503471);
     }
     $newNodeData = new NodeData($newPath, $nodeWorkspace, $identifier, $dimensions);
     $this->nodeDataRepository->add($newNodeData);
     $this->nodeDataRepository->setNewIndex($newNodeData, NodeDataRepository::POSITION_LAST);
     if ($nodeType !== NULL) {
         $newNodeData->setNodeType($nodeType);
     }
     return $newNodeData;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:31,代码来源:NodeData.php


注:本文中的TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。