本文整理汇总了PHP中PHPCR\NodeInterface::getNodes方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::getNodes方法的具体用法?PHP NodeInterface::getNodes怎么用?PHP NodeInterface::getNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCR\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::getNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNodes
/**
* @see \PHPCR\NodeInterface::getNodes
*/
public function getNodes($filter = null)
{
$nodes = $this->node->getNodes($filter);
foreach ($nodes as $name => $node) {
$nodes[$name] = new Node($node);
}
return $nodes;
}
示例2: initialize
/**
* {@inheritdoc}
*/
protected function initialize()
{
if (true === $this->initialized) {
return;
}
$this->documents = $this->parentNode->getNodes();
$this->initialized = true;
}
示例3: upgradeNode
/**
* Removes non translated properties.
*
* @param NodeInterface $node
*/
private function upgradeNode(NodeInterface $node)
{
foreach ($node->getProperties('i18n:-*') as $property) {
$property->remove();
}
foreach ($node->getNodes() as $childNode) {
$this->upgradeNode($childNode);
}
}
示例4: traverse
private function traverse(NodeInterface $node)
{
$i = 10;
foreach ($node->getNodes() as $childNode) {
$childNode->setProperty(NodeOrderSubscriber::SULU_ORDER, $i);
$this->context->getOutput()->writeln(sprintf('<info>[+]</info> Setting order "<comment>%s</comment>" on <comment>%s</comment>', $i, $childNode->getPath()));
$this->traverse($childNode);
$i += 10;
}
}
示例5: getLocalesFor
/**
* {@inheritdoc}
*/
public function getLocalesFor($document, NodeInterface $node, ClassMetadata $metadata)
{
$translations = $node->getNodes(Translation::LOCALE_NAMESPACE . ':*');
$locales = array();
foreach ($translations as $name => $node) {
if ($p = strpos($name, ':')) {
$locales[] = substr($name, $p + 1);
}
}
return $locales;
}
示例6: initProperties
/**
* This method populates the test case properties both at test setUp
* and after renewing the session.
*
* The default schema is to have a root node /test_<something> with one
* child node per test with the node name being the test name.
*/
protected function initProperties()
{
$this->session = $this->sharedFixture['session'];
$this->node = null;
$this->rootNode = $this->session->getRootNode();
$children = $this->rootNode->getNodes('tests_*');
$child = $children->current();
if ($child && $child->hasNode($this->getName())) {
$this->node = $child->getNode($this->getName());
}
}
示例7: traverse
private function traverse(NodeInterface $node, $readProperties = false)
{
if ($readProperties) {
foreach ($node->getProperties() as $property) {
try {
$property->getValue();
} catch (\PHPCR\RepositoryException $e) {
}
}
}
foreach ($node->getNodes() as $child) {
$this->traverse($child, $readProperties);
}
}
示例8: upgradeNode
/**
* Upgrade a single node.
*
* @param NodeInterface $node
* @param string $propertyName
* @param string $locale
*/
private function upgradeNode(NodeInterface $node, $propertyName, $locale)
{
foreach ($node->getNodes() as $child) {
$this->upgradeNode($child, $propertyName, $locale);
}
if (false === $node->getPropertyValueWithDefault($propertyName, false)) {
return;
}
$shadowLocale = $node->getPropertyValue($this->getPropertyName(self::SHADOW_BASE_PROPERTY, $locale));
$tags = $this->getTags($node, $shadowLocale);
$categories = $this->getCategories($node, $shadowLocale);
$navigationContext = $this->getNavigationContext($node, $shadowLocale);
$node->setProperty(sprintf(self::TAGS_PROPERTY, $locale), $tags);
$node->setProperty(sprintf(self::CATEGORIES_PROPERTY, $locale), $categories);
$node->setProperty(sprintf(self::NAVIGATION_CONTEXT_PROPERTY, $locale), $navigationContext);
}
示例9: testGetNodesTypeFilterList
public function testGetNodesTypeFilterList()
{
$this->node = $this->rootNode->getNode('tests_general_base');
$iterator = $this->node->getNodes('id*', array('nt:file', 'nt:folder'));
$nodes = array();
foreach ($iterator as $n) {
$this->assertInstanceOf('PHPCR\\NodeInterface', $n);
/* @var $n \PHPCR\NodeInterface */
array_push($nodes, $n->getName());
}
$this->assertNotContains('index.txt', $nodes);
$this->assertContains('idExample', $nodes);
$this->assertNotContains('test:namespacedNode', $nodes);
$this->assertNotContains('emptyExample', $nodes);
$this->assertNotContains('multiValueProperty', $nodes);
$this->assertNotContains('numberPropertyNode', $nodes);
$this->assertNotContains('NumberPropertyNodeToCompare1', $nodes);
$this->assertNotContains('NumberPropertyNodeToCompare2', $nodes);
}
示例10: setNodeWorkflowStageToTestForCopy
/**
* Sets the workflowstage and the published date for the given node and all of its children to test resp. null. This
* is done for every language in which the given properties exist.
*
* @param NodeInterface $node
*/
private function setNodeWorkflowStageToTestForCopy(NodeInterface $node)
{
$workflowStageNameFilter = $this->propertyEncoder->localizedSystemName(self::WORKFLOW_STAGE_FIELD, '*');
foreach ($node->getProperties($workflowStageNameFilter) as $property) {
/** @var PropertyInterface $property */
$property->setValue(WorkflowStage::TEST);
}
$publishedNameFilter = $this->propertyEncoder->localizedSystemName(self::PUBLISHED_FIELD, '*');
foreach ($node->getProperties($publishedNameFilter) as $property) {
/** @var PropertyInterface $property */
$property->setValue(null);
}
foreach ($node->getNodes() as $node) {
/** @var NodeInterface $node */
$this->setNodeWorkflowStageToTestForCopy($node);
}
}
示例11: filterChildNodeNamesByType
/**
* This method will either let the transport filter if that is possible or
* forward to getNodes and return the names of the nodes found there.,
*
* @param NodeInterface $node
* @param string|array $nameFilter
* @param string|array $typeFilter
*
* @return ArrayIterator
*/
public function filterChildNodeNamesByType(NodeInterface $node, $nameFilter, $typeFilter)
{
if ($this->transport instanceof NodeTypeFilterInterface) {
return $this->transport->filterChildNodeNamesByType($node->getPath(), $node->getNodeNames($nameFilter), $typeFilter);
}
// fallback: get the actual nodes and let that filter. this is expensive.
return new ArrayIterator(array_keys($node->getNodes($nameFilter, $typeFilter)->getArrayCopy()));
}
示例12: resolveAfterSiblingName
/**
* If the node should be ordered after the target then we need to order the
* node before the sibling after the target sibling. If the node should be the
* last sibling, then the target sibling should be NULL.
*
* @param NodeInterface $parentNode
* @param string $siblingName
*
* @return string
*/
private function resolveAfterSiblingName(NodeInterface $parentNode, $siblingName)
{
$targetName = null;
$found = false;
foreach (array_keys($parentNode->getNodes()) as $name) {
if ($name === $siblingName) {
$found = true;
continue;
} elseif ($found) {
$targetName = $name;
break;
}
}
return $targetName;
}
示例13: cleanup
/**
* Cleanup specific node and his children.
*
* @param NodeInterface $node
* @param string $rootPath
* @param bool $dryRun
*/
private function cleanup(OutputInterface $output, NodeInterface $node, $rootPath, $dryRun)
{
foreach ($node->getNodes() as $childNode) {
$this->cleanup($output, $childNode, $rootPath, $dryRun);
}
$path = ltrim(str_replace($rootPath, '', $node->getPath()), '/');
if (!$node->getPropertyValueWithDefault('sulu:history', false)) {
$output->writeln('<info>Processing aborted: </info>/' . $path . ' <comment>(no history url)</comment>');
return;
}
if ($dryRun === false) {
$node->remove();
}
$output->writeln('<info>Processing: </info>/' . $path);
}
示例14: getNodes
/**
* {@inheritdoc}
*/
public function getNodes($nameFilter = null, $typeFilter = null)
{
return $this->node->getNodes($nameFilter, $typeFilter);
}
示例15: upgradeByParent
private function upgradeByParent(NodeInterface $parentNode, Webspace $webspace, Localization $localization, OutputInterface $output)
{
foreach ($parentNode->getNodes() as $childNode) {
$this->upgradeNode($childNode, $webspace, $localization, $output, substr_count($childNode->getPath(), '/'));
$this->upgradeByParent($childNode, $webspace, $localization, $output);
}
}