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


PHP NodeInterface::getProperties方法代码示例

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


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

示例1: serializePhpcrNode

 /**
  * @param JsonSerializationVisitor $visitor
  * @param NodeInterface            $nodeInterface
  * @param array                    $type
  * @param Context                  $context
  */
 public function serializePhpcrNode(JsonSerializationVisitor $visitor, NodeInterface $node, array $type, Context $context)
 {
     $res = array();
     foreach ($node->getProperties() as $name => $property) {
         $res[$name] = $property->getValue();
     }
     return $res;
 }
开发者ID:frogriotcom,项目名称:ResourceRestBundle,代码行数:14,代码来源:PhpcrNodeHandler.php

示例2: 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);
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:14,代码来源:Version201512090753.php

示例3: testGetPropertiesNameGlobs

 public function testGetPropertiesNameGlobs()
 {
     $iterator = $this->node->getProperties(array('jcr:cr*', 'jcr:prim*'));
     $this->assertInstanceOf('Iterator', $iterator);
     $props = array();
     foreach ($iterator as $prop) {
         array_push($props, $prop->getName());
     }
     $this->assertContains('jcr:created', $props);
     $this->assertContains('jcr:primaryType', $props);
 }
开发者ID:laurentiuc,项目名称:phpcr-api-tests,代码行数:11,代码来源:NodeReadMethodsTest.php

示例4: getLocalesFor

 /**
  * {@inheritdoc}
  */
 public function getLocalesFor($document, NodeInterface $node, ClassMetadata $metadata)
 {
     $locales = array();
     foreach ($node->getProperties("*{$this->prefix}*") as $prop) {
         $matches = null;
         if (preg_match('/' . $this->prefix . ':(..)-[^-]*/', $prop->getName(), $matches)) {
             if (is_array($matches) && count($matches) > 1 && !in_array($matches[1], $locales)) {
                 $locales[] = $matches[1];
             }
         }
     }
     return $locales;
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:16,代码来源:AttributeTranslationStrategy.php

示例5: it_can_normalize_a_node_to_an_array

 public function it_can_normalize_a_node_to_an_array(NodeInterface $node, PropertyInterface $p1, PropertyInterface $p2, PropertyInterface $p3)
 {
     $node->getProperties()->willReturn([$p1, $p2, $p3]);
     $p1->getName()->willReturn('my:property.1');
     $p1->getType()->willReturn(PropertyType::STRING);
     $p1->getValue()->willReturn('P1 Val');
     $p2->getName()->willReturn('my:property.2');
     $p2->getType()->willReturn(PropertyType::DOUBLE);
     $p2->getValue()->willReturn('P2 Val');
     $p3->getName()->willReturn('my:property.3');
     $p3->getType()->willReturn(PropertyType::STRING);
     $p3->getValue()->willReturn('P3 Val');
     $this->normalize($node)->shouldReturn(['my:property.1' => ['type' => 'String', 'value' => 'P1 Val'], 'my:property.2' => ['type' => 'Double', 'value' => 'P2 Val'], 'my:property.3' => ['type' => 'String', 'value' => 'P3 Val']]);
 }
开发者ID:phpcr,项目名称:phpcr-shell,代码行数:14,代码来源:NodeNormalizerSpec.php

示例6: 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);
     }
 }
开发者ID:phpcr,项目名称:phpcr-benchmarks,代码行数:14,代码来源:TraversalBench.php

示例7: 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);
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:23,代码来源:WorkflowStageSubscriber.php

示例8: remove

 /**
  * {@inheritdoc}
  */
 public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     foreach ($node->getProperties($property->getName() . '-*') as $nodeProperty) {
         $node->getProperty($nodeProperty->getName())->remove();
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:9,代码来源:BlockContentType.php

示例9: getLocalizedPropertyValues

 /**
  * Return all the localized values of the localized property indicated
  * by $name.
  *
  * @param NodeInterface $node
  * @param string        $name Name of localized property
  */
 public function getLocalizedPropertyValues(NodeInterface $node, $name)
 {
     $values = [];
     foreach ($node->getProperties() as $property) {
         /* @var PropertyInterface $property */
         preg_match('/^' . $this->languageNamespace . ':([a-zA-Z_]*?)-' . $name . '/', $property->getName(), $matches);
         if ($matches) {
             $values[$matches[1]] = $property->getValue();
         }
     }
     return $values;
 }
开发者ID:sulu,项目名称:sulu,代码行数:19,代码来源:SuluNodeHelper.php

示例10: exportDocumentViewRecursive

 /**
  * Recursively output node and all its children into the file in the
  * document view format
  *
  * @param NodeInterface              $node       the node to output
  * @param NamespaceRegistryInterface $ns         The namespace registry to export namespaces too
  * @param resource                   $stream     the resource to write data out to
  * @param boolean                    $skipBinary A boolean governing whether binary properties
  *      are to be serialized.
  * @param boolean $noRecurse A boolean governing whether the subgraph at
  *      absPath is to be recursed.
  * @param boolean $root Whether this is the root node of the resulting
  *      document, meaning the namespace declarations have to be included in
  *      it.
  */
 private static function exportDocumentViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
 {
     $nodename = self::escapeXmlName($node->getName());
     fwrite($stream, "<{$nodename}");
     if ($root) {
         self::exportNamespaceDeclarations($ns, $stream);
     }
     foreach ($node->getProperties() as $name => $property) {
         /** @var $property \PHPCR\PropertyInterface */
         if ($property->isMultiple()) {
             // skip multiple properties. jackrabbit does this too. cheap but whatever. use system view for a complete export
             continue;
         }
         if (PropertyType::BINARY == $property->getType()) {
             if ($skipBinary) {
                 continue;
             }
             $value = base64_encode($property->getString());
         } else {
             $value = htmlspecialchars($property->getString());
         }
         fwrite($stream, ' ' . self::escapeXmlName($name) . '="' . $value . '"');
     }
     if ($noRecurse || !$node->hasNodes()) {
         fwrite($stream, '/>');
     } else {
         fwrite($stream, '>');
         foreach ($node as $child) {
             if (!($child->getDepth() == 1 && NodeHelper::isSystemItem($child))) {
                 self::exportDocumentViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
             }
         }
         fwrite($stream, "</{$nodename}>");
     }
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:50,代码来源:ImportExport.php

示例11: removeLocalizedNodeProperties

 /**
  * Removes all localized properties in the given locale from the given node.
  *
  * @param NodeInterface $node
  * @param string $locale
  */
 private function removeLocalizedNodeProperties(NodeInterface $node, $locale)
 {
     // remove all localized system properties from the node
     foreach ($node->getProperties($this->propertyEncoder->localizedSystemName('', $locale) . '*') as $property) {
         $property->remove();
     }
     // remove all localized content properties from the node
     foreach ($node->getProperties($this->propertyEncoder->localizedContentName('', $locale) . '*') as $property) {
         $property->remove();
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:17,代码来源:PublishSubscriber.php

示例12: getProperties

 /**
  * {@inheritdoc}
  */
 public function getProperties($nameFilter = null)
 {
     return $this->node->getProperties($nameFilter);
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:SuluNode.php

示例13: parsePhpcrNode

 private function parsePhpcrNode(NodeInterface $node)
 {
     $this->parsePhpcrNodeProperties($node->getProperties());
 }
开发者ID:jackalope,项目名称:jackalope-fs,代码行数:4,代码来源:Node.php

示例14: formatNodePropertiesInline

 public function formatNodePropertiesInline(NodeInterface $node)
 {
     $out = array();
     foreach ($node->getProperties() as $property) {
         $out[] = sprintf('%s: %s', $property->getName(), $this->formatValue($property));
     }
     return implode(', ', $out);
 }
开发者ID:hason,项目名称:phpcr-shell,代码行数:8,代码来源:ResultFormatterHelper.php


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