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


PHP NodeDataRepository::update方法代码示例

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


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

示例1: execute

 /**
  * Execute the migration
  *
  * @return void
  */
 public function execute()
 {
     foreach ($this->nodeDataRepository->findAll() as $node) {
         foreach ($this->configuration as $migrationDescription) {
             if ($this->nodeFilterService->matchFilters($node, $migrationDescription['filters'])) {
                 $this->nodeTransformationService->execute($node, $migrationDescription['transformations']);
                 if (!$this->nodeDataRepository->isInRemovedNodes($node)) {
                     $this->nodeDataRepository->update($node);
                 }
             }
         }
     }
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:18,代码来源:NodeMigration.php

示例2: removeContentDimensionsFromRootAndSitesNode

 /**
  * Remove dimensions on nodes "/" and "/sites"
  *
  * This empties the content dimensions on those nodes, so when traversing via the Node API from the root node,
  * the nodes below "/sites" are always reachable.
  *
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 public function removeContentDimensionsFromRootAndSitesNode($workspaceName, $dryRun)
 {
     $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
     $rootNodes = $this->nodeDataRepository->findByPath('/', $workspace);
     $sitesNodes = $this->nodeDataRepository->findByPath('/sites', $workspace);
     $this->output->outputLine('Checking for root and site nodes with content dimensions set ...');
     /** @var \TYPO3\TYPO3CR\Domain\Model\NodeData $rootNode */
     foreach ($rootNodes as $rootNode) {
         if ($rootNode->getDimensionValues() !== []) {
             if ($dryRun === false) {
                 $rootNode->setDimensions([]);
                 $this->nodeDataRepository->update($rootNode);
                 $this->output->outputLine('Removed content dimensions from root node');
             } else {
                 $this->output->outputLine('Found root node with content dimensions set.');
             }
         }
     }
     /** @var \TYPO3\TYPO3CR\Domain\Model\NodeData $sitesNode */
     foreach ($sitesNodes as $sitesNode) {
         if ($sitesNode->getDimensionValues() !== []) {
             if ($dryRun === false) {
                 $sitesNode->setDimensions([]);
                 $this->nodeDataRepository->update($sitesNode);
                 $this->output->outputLine('Removed content dimensions from node "/sites"');
             } else {
                 $this->output->outputLine('Found node "/sites"');
             }
         }
     }
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:41,代码来源:NodeCommandControllerPlugin.php

示例3: createChildNodesByNodeType

 /**
  * Create missing child nodes for the given node type
  *
  * @param NodeType $nodeType
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 protected function createChildNodesByNodeType(NodeType $nodeType, $workspaceName, $dryRun)
 {
     $createdNodesCount = 0;
     $updatedNodesCount = 0;
     $nodeCreationExceptions = 0;
     $nodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), false);
     $nodeTypes[$nodeType->getName()] = $nodeType;
     if ($this->nodeTypeManager->hasNodeType((string) $nodeType)) {
         $nodeType = $this->nodeTypeManager->getNodeType((string) $nodeType);
         $nodeTypeNames[$nodeType->getName()] = $nodeType;
     } else {
         $this->output->outputLine('Node type "%s" does not exist', array((string) $nodeType));
         exit(1);
     }
     /** @var $nodeType NodeType */
     foreach ($nodeTypes as $nodeTypeName => $nodeType) {
         $childNodes = $nodeType->getAutoCreatedChildNodes();
         foreach ($this->getNodeDataByNodeTypeAndWorkspace($nodeTypeName, $workspaceName) as $nodeData) {
             $context = $this->nodeFactory->createContextMatchingNodeData($nodeData);
             $node = $this->nodeFactory->createFromNodeData($nodeData, $context);
             if (!$node instanceof NodeInterface) {
                 continue;
             }
             foreach ($childNodes as $childNodeName => $childNodeType) {
                 try {
                     $childNode = $node->getNode($childNodeName);
                     $childNodeIdentifier = Utility::buildAutoCreatedChildNodeIdentifier($childNodeName, $node->getIdentifier());
                     if ($childNode === null) {
                         if ($dryRun === false) {
                             $node->createNode($childNodeName, $childNodeType, $childNodeIdentifier);
                             $this->output->outputLine('Auto created node named "%s" in "%s"', array($childNodeName, $node->getPath()));
                         } else {
                             $this->output->outputLine('Missing node named "%s" in "%s"', array($childNodeName, $node->getPath()));
                         }
                         $createdNodesCount++;
                     } elseif ($childNode->getIdentifier() !== $childNodeIdentifier) {
                         if ($dryRun === false) {
                             $nodeData = $childNode->getNodeData();
                             $nodeData->setIdentifier($childNodeIdentifier);
                             $this->nodeDataRepository->update($nodeData);
                             $this->output->outputLine('Updated identifier to %s for child node "%s" in "%s"', array($childNodeIdentifier, $childNodeName, $node->getPath()));
                         } else {
                             $this->output->outputLine('Child node "%s" in "%s" does not have a stable identifier', array($childNodeName, $node->getPath()));
                         }
                         $updatedNodesCount++;
                     }
                 } catch (\Exception $exception) {
                     $this->output->outputLine('Could not create node named "%s" in "%s" (%s)', array($childNodeName, $node->getPath(), $exception->getMessage()));
                     $nodeCreationExceptions++;
                 }
             }
         }
     }
     if ($createdNodesCount !== 0 || $nodeCreationExceptions !== 0 || $updatedNodesCount !== 0) {
         if ($dryRun === false) {
             if ($createdNodesCount > 0) {
                 $this->output->outputLine('Created %s new child nodes', array($createdNodesCount));
             }
             if ($updatedNodesCount > 0) {
                 $this->output->outputLine('Updated identifier of %s child nodes', array($updatedNodesCount));
             }
             if ($nodeCreationExceptions > 0) {
                 $this->output->outputLine('%s Errors occurred during child node creation', array($nodeCreationExceptions));
             }
             $this->persistenceManager->persistAll();
         } else {
             if ($createdNodesCount > 0) {
                 $this->output->outputLine('%s missing child nodes need to be created', array($createdNodesCount));
             }
             if ($updatedNodesCount > 0) {
                 $this->output->outputLine('%s identifiers of child nodes need to be updated', array($updatedNodesCount));
             }
         }
     }
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:83,代码来源:NodeCommandControllerPlugin.php

示例4: update

 /**
  * Updates this node in the Node Repository
  *
  * @return void
  */
 protected function update()
 {
     $this->nodeDataRepository->update($this);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:9,代码来源:NodeData.php


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