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


PHP NodeDataRepository::findOneByPath方法代码示例

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


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

示例1: findOneByPathFindsRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions

 /**
  * @test
  */
 public function findOneByPathFindsRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
 {
     $liveWorkspace = new Workspace('live');
     $nodeData = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData')->disableOriginalConstructor()->getMock();
     $nodeData->expects($this->any())->method('getPath')->will($this->returnValue('/foo'));
     $this->nodeDataRepository->remove($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));
     $result = $this->nodeDataRepository->findOneByPath('/foo', $liveWorkspace, $dimensions);
     $this->assertNull($result);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:14,代码来源:NodeDataRepositoryTest.php

示例2: findOneByPathFindsAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions

 /**
  * @test
  */
 public function findOneByPathFindsAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
 {
     $liveWorkspace = new Workspace('live');
     $dimensions = ['persona' => ['everybody'], 'language' => ['de_DE', 'mul_ZZ']];
     $nodeData = $this->getMockBuilder(NodeData::class)->disableOriginalConstructor()->getMock();
     $nodeData->expects($this->any())->method('getPath')->will($this->returnValue('/foo'));
     $nodeData->expects($this->any())->method('getWorkspace')->will($this->returnValue($liveWorkspace));
     $nodeData->expects($this->any())->method('getDimensionValues')->will($this->returnValue($dimensions));
     $nodeData->expects($this->atLeastOnce())->method('matchesWorkspaceAndDimensions')->with($liveWorkspace, $dimensions)->will($this->returnValue(true));
     $this->mockQuery->expects($this->any())->method('getResult')->will($this->returnValue([]));
     $this->nodeDataRepository->add($nodeData);
     $result = $this->nodeDataRepository->findOneByPath('/foo', $liveWorkspace, $dimensions);
     $this->assertSame($nodeData, $result);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:17,代码来源:NodeDataRepositoryTest.php

示例3: execute

 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return NodeData
  */
 public function execute(NodeData $node)
 {
     $reference = (string) $node->getProperty('plugin');
     $workspace = $node->getWorkspace();
     do {
         if ($this->reverse === false && preg_match(NodeInterface::MATCH_PATTERN_PATH, $reference)) {
             $pluginNode = $this->nodeDataRepository->findOneByPath($reference, $node->getWorkspace());
         } else {
             $pluginNode = $this->nodeDataRepository->findOneByIdentifier($reference, $node->getWorkspace());
         }
         if (isset($pluginNode)) {
             break;
         }
         $workspace = $workspace->getBaseWorkspace();
     } while ($workspace && $workspace->getName() !== 'live');
     if (isset($pluginNode)) {
         $node->setProperty('plugin', $this->reverse === false ? $pluginNode->getIdentifier() : $pluginNode->getPath());
     }
     return $node;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:26,代码来源:PluginViewTransformation.php

示例4: updateSiteAction

 /**
  * Update a site
  *
  * @param Site $site A site to update
  * @param string $newSiteNodeName A new site node name
  * @return void
  * @Flow\Validate(argumentName="$site", type="UniqueEntity")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 })
  * @Flow\Validate(argumentName="$newSiteNodeName", type="TYPO3.Neos:NodeName")
  */
 public function updateSiteAction(Site $site, $newSiteNodeName)
 {
     if ($site->getNodeName() !== $newSiteNodeName) {
         $oldSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName());
         $newSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $newSiteNodeName);
         /** @var $workspace Workspace */
         foreach ($this->workspaceRepository->findAll() as $workspace) {
             $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace);
             if ($siteNode !== null) {
                 $siteNode->setPath($newSiteNodePath);
             }
         }
         $site->setNodeName($newSiteNodeName);
         $this->nodeDataRepository->persistEntities();
     }
     $this->siteRepository->update($site);
     $this->addFlashMessage('The site "%s" has been updated.', 'Update', null, array(htmlspecialchars($site->getName())), 1412371798);
     $this->unsetLastVisitedNodeAndRedirect('index');
 }
开发者ID:sbruggmann,项目名称:neos-development-collection,代码行数:30,代码来源:SitesController.php

示例5: updateSiteAction

 /**
  * Update a site
  *
  * @param Site $site A site to update
  * @param string $newSiteNodeName A new site node name
  * @return void
  * @Flow\Validate(argumentName="$site", type="UniqueEntity")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 })
  * @Flow\Validate(argumentName="$newSiteNodeName", type="TYPO3.Neos:NodeName")
  */
 public function updateSiteAction(Site $site, $newSiteNodeName)
 {
     if ($site->getNodeName() !== $newSiteNodeName) {
         $oldSiteNodePath = '/sites/' . $site->getNodeName();
         $newSiteNodePath = '/sites/' . $newSiteNodeName;
         /** @var $workspace Workspace */
         foreach ($this->workspaceRepository->findAll() as $workspace) {
             $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace);
             if ($siteNode !== NULL) {
                 $siteNode->setPath($newSiteNodePath);
             }
         }
         $site->setNodeName($newSiteNodeName);
         $this->nodeDataRepository->persistEntities();
     }
     $this->siteRepository->update($site);
     $this->addFlashMessage('The site "%s" has been updated.', 'Update', NULL, array($site->getName()), 1412371798);
     $this->unsetLastVisitedNodeAndRedirect('index');
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:30,代码来源:SitesController.php

示例6: fixShadowNodesInWorkspace

 /**
  * Collects all nodes with missing shadow nodes
  *
  * @param Workspace $workspace
  * @param boolean $dryRun
  * @param NodeType $nodeType
  * @return array
  */
 protected function fixShadowNodesInWorkspace(Workspace $workspace, $dryRun, NodeType $nodeType = null)
 {
     $workspaces = array_merge([$workspace], $workspace->getBaseWorkspaces());
     $fixedShadowNodes = 0;
     foreach ($workspaces as $workspace) {
         /** @var Workspace $workspace */
         if ($workspace->getBaseWorkspace() === null) {
             continue;
         }
         /** @var QueryBuilder $queryBuilder */
         $queryBuilder = $this->entityManager->createQueryBuilder();
         $queryBuilder->select('n')->from(NodeData::class, 'n')->where('n.workspace = :workspace');
         $queryBuilder->setParameter('workspace', $workspace->getName());
         if ($nodeType !== null) {
             $queryBuilder->andWhere('n.nodeType = :nodeType');
             $queryBuilder->setParameter('nodeType', $nodeType->getName());
         }
         /** @var NodeData $nodeData */
         foreach ($queryBuilder->getQuery()->getResult() as $nodeData) {
             $nodeDataSeenFromParentWorkspace = $this->nodeDataRepository->findOneByIdentifier($nodeData->getIdentifier(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues());
             // This is the good case, either the node does not exist or was shadowed
             if ($nodeDataSeenFromParentWorkspace === null) {
                 continue;
             }
             // Also good, the node was not moved at all.
             if ($nodeDataSeenFromParentWorkspace->getPath() === $nodeData->getPath()) {
                 continue;
             }
             $nodeDataOnSamePath = $this->nodeDataRepository->findOneByPath($nodeData->getPath(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues(), null);
             // We cannot just put a shadow node in the path, something exists, but that should be fine.
             if ($nodeDataOnSamePath !== null) {
                 continue;
             }
             if (!$dryRun) {
                 $nodeData->createShadow($nodeDataSeenFromParentWorkspace->getPath());
             }
             $fixedShadowNodes++;
         }
     }
     return $fixedShadowNodes;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:49,代码来源:NodeCommandControllerPlugin.php

示例7: adjustShadowNodePath

 /**
  * Adjusts the path of $shadowNodeData to $path, if needed/possible.
  *
  * If the $path is occupied in $targetWorkspace, the shadow is removed.
  *
  * @param NodeData $shadowNodeData
  * @param $path
  * @param Workspace $targetWorkspace
  * @param array $dimensionValues
  * @return void
  */
 protected function adjustShadowNodePath(NodeData $shadowNodeData, $path, Workspace $targetWorkspace, array $dimensionValues)
 {
     $nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($path, $targetWorkspace, $dimensionValues);
     if ($nodeOnSamePathInTargetWorkspace === null || $nodeOnSamePathInTargetWorkspace->getWorkspace() !== $targetWorkspace) {
         $shadowNodeData->setPath($path, false);
         return;
     }
     // A node exists in that path, so no shadow node is needed/possible.
     $this->nodeDataRepository->remove($shadowNodeData);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:21,代码来源:Workspace.php

示例8: listFormPostsAction

 /**
  * Returns the form post values
  *
  * @param string $path Absolute path of the node
  * @return void
  */
 public function listFormPostsAction($path)
 {
     $context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $formNode = $this->nodeDataRepository->findOneByPath($path, $context->getWorkspace());
     $this->view->assignMultiple(array('formIdentifier' => $formNode->getProperty('formIdentifier'), 'formPosts' => $this->nodeDataRepository->findByParentAndNodeTypeRecursively($formNode->getParentPath(), 'Lelesys.Plugin.ContactForm:FormPost', $context->getWorkspace())));
 }
开发者ID:desaisagar,项目名称:Lelesys.Plugin.ContactForm,代码行数:12,代码来源:ContactListController.php

示例9: getNode

 /**
  * Returns a node specified by the given relative path.
  *
  * @param string $path Path specifying the node, relative to this node
  * @return \TYPO3\TYPO3CR\Domain\Model\NodeData The specified node or NULL if no such node exists
  *
  * TODO This method should be removed, since it doesn't take the context into account correctly
  */
 public function getNode($path)
 {
     return $this->nodeDataRepository->findOneByPath($this->normalizePath($path), $this->workspace);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:12,代码来源:NodeData.php


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