本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::findByParentAndNodeType方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDataRepository::findByParentAndNodeType方法的具体用法?PHP NodeDataRepository::findByParentAndNodeType怎么用?PHP NodeDataRepository::findByParentAndNodeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository
的用法示例。
在下文中一共展示了NodeDataRepository::findByParentAndNodeType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findByParentAndNodeTypeLimitsToRootNodeCorrectly
/**
* Tests addParentPathConstraintToQueryBuilder, see https://jira.neos.io/browse/NEOS-1849
*
* @test
*/
public function findByParentAndNodeTypeLimitsToRootNodeCorrectly()
{
$this->setUpNodes();
$workspace = $this->context->getWorkspace();
$foundNodes = $this->nodeDataRepository->findByParentAndNodeType('/', 'unstructured', $workspace, [], false, true);
$this->assertCount(6, $foundNodes);
}
示例2: doDiscardNode
/**
* Method which does the actual work of discarding, includes a protection against endless recursions and
* multiple discarding of the same node.
*
* @param NodeInterface $node The node to discard
* @param array &$alreadyDiscardedNodeIdentifiers List of node identifiers which already have been discarded during one discardNode() run
* @return void
* @throws \TYPO3\TYPO3CR\Exception\WorkspaceException
*/
protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = [])
{
if ($node->getWorkspace()->getBaseWorkspace() === null) {
throw new WorkspaceException('Nodes in a in a workspace without a base workspace cannot be discarded.', 1395841899);
}
if ($node->getPath() === '/') {
return;
}
if (array_search($node->getIdentifier(), $alreadyDiscardedNodeIdentifiers) !== false) {
return;
}
$alreadyDiscardedNodeIdentifiers[] = $node->getIdentifier();
$possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData());
if ($possibleShadowNodeData instanceof NodeData) {
if ($possibleShadowNodeData->getMovedTo() !== null) {
$parentBasePath = $node->getPath();
$affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true);
foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) {
/** @var NodeData $affectedChildNodeData */
$affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext());
$this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers);
}
}
$this->nodeDataRepository->remove($possibleShadowNodeData);
}
$this->nodeDataRepository->remove($node);
$this->emitNodeDiscarded($node);
}
示例3: findByParentAndNodeTypeRemovesRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions
/**
* @test
*/
public function findByParentAndNodeTypeRemovesRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
{
$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->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));
$this->nodeDataRepository->expects($this->any())->method('getNodeDataForParentAndNodeType')->will($this->returnValue(array('abcd-efgh-ijkl-mnop' => $nodeData)));
$result = $this->nodeDataRepository->findByParentAndNodeType('/foo', NULL, $liveWorkspace, $dimensions);
$this->assertCount(0, $result);
}