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


PHP NodeInterface::isNodeType方法代码示例

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


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

示例1: testIsNotMixin

 public function testIsNotMixin()
 {
     $this->assertFalse($this->versioned->isNodeType('mix:language'));
 }
开发者ID:rederrik,项目名称:phpcr-api-tests,代码行数:4,代码来源:NodeTypeReadTest.php

示例2: setMixins

 /**
  * Set the mapped mixins.
  *
  * @param ClassMetadata $metadata
  * @param NodeInterface $node
  * @param object        $document The document to update autogenerated fields.
  */
 private function setMixins(Mapping\ClassMetadata $metadata, NodeInterface $node, $document)
 {
     $repository = $this->session->getRepository();
     if ($metadata->versionable === 'full') {
         if ($repository->getDescriptor(RepositoryInterface::OPTION_VERSIONING_SUPPORTED)) {
             $node->addMixin('mix:versionable');
         } elseif ($repository->getDescriptor(RepositoryInterface::OPTION_SIMPLE_VERSIONING_SUPPORTED)) {
             $node->addMixin('mix:simpleVersionable');
         }
     } elseif ($metadata->versionable === 'simple' && $repository->getDescriptor(RepositoryInterface::OPTION_SIMPLE_VERSIONING_SUPPORTED)) {
         $node->addMixin('mix:simpleVersionable');
     }
     if (!$node->isNodeType('mix:referenceable') && $metadata->referenceable) {
         $node->addMixin('mix:referenceable');
     }
     // manually set the uuid if it is not present yet, so we can assign it to documents
     if ($node->isNodeType('mix:referenceable') && !$node->hasProperty('jcr:uuid')) {
         $uuid = false;
         $uuidFieldName = $metadata->getUuidFieldName();
         if ($uuidFieldName) {
             $uuid = $metadata->getFieldValue($document, $uuidFieldName);
         }
         if (!$uuid) {
             $uuid = $this->generateUuid();
         }
         $node->setProperty('jcr:uuid', $uuid);
         if ($uuidFieldName && !$metadata->getFieldValue($document, $uuidFieldName)) {
             $metadata->setFieldValue($document, $uuidFieldName, $uuid);
         }
     }
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:38,代码来源:UnitOfWork.php

示例3: matchNodeType

 /**
  * Check if a node is of any of the types listed in typeFilter.
  *
  * @param NodeInterface $node
  * @param array         $typeFilter
  *
  * @return boolean
  */
 private function matchNodeType(NodeInterface $node, array $typeFilter)
 {
     foreach ($typeFilter as $type) {
         if ($node->isNodeType($type)) {
             return true;
         }
     }
     return false;
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:17,代码来源:ObjectManager.php

示例4: exportSystemViewRecursive

 /**
  * Recursively output node and all its children into the file in the system
  * view format
  *
  * @param NodeInterface $node   the node to output
  * @param resource      $stream The stream resource (i.e. acquired with fopen) to
  *      which the XML serialization of the subgraph will be output. Must
  *      support the fwrite method.
  * @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 exportSystemViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
 {
     fwrite($stream, '<sv:node');
     if ($root) {
         self::exportNamespaceDeclarations($ns, $stream);
     }
     fwrite($stream, ' sv:name="' . (0 === $node->getDepth() ? 'jcr:root' : htmlspecialchars($node->getName())) . '">');
     // the order MUST be primary type, then mixins, if any, then jcr:uuid if its a referenceable node
     fwrite($stream, '<sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>' . htmlspecialchars($node->getPropertyValue('jcr:primaryType')) . '</sv:value></sv:property>');
     if ($node->hasProperty('jcr:mixinTypes')) {
         fwrite($stream, '<sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true">');
         foreach ($node->getPropertyValue('jcr:mixinTypes') as $type) {
             fwrite($stream, '<sv:value>' . htmlspecialchars($type) . '</sv:value>');
         }
         fwrite($stream, '</sv:property>');
     }
     if ($node->isNodeType('mix:referenceable')) {
         fwrite($stream, '<sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>' . $node->getIdentifier() . '</sv:value></sv:property>');
     }
     foreach ($node->getProperties() as $name => $property) {
         /** @var $property \PHPCR\PropertyInterface */
         if ($name == 'jcr:primaryType' || $name == 'jcr:mixinTypes' || $name == 'jcr:uuid') {
             // explicitly handled before
             continue;
         }
         if (PropertyType::BINARY == $property->getType() && $skipBinary) {
             // do not output binary data in the xml
             continue;
         }
         fwrite($stream, '<sv:property sv:name="' . htmlentities($name) . '" sv:type="' . PropertyType::nameFromValue($property->getType()) . '"' . ($property->isMultiple() ? ' sv:multiple="true"' : '') . '>');
         $values = $property->isMultiple() ? $property->getString() : array($property->getString());
         foreach ($values as $value) {
             if (PropertyType::BINARY == $property->getType()) {
                 $val = base64_encode($value);
             } else {
                 $val = htmlspecialchars($value);
                 //TODO: can we still have invalid characters after this? if so base64 and property, xsi:type="xsd:base64Binary"
             }
             fwrite($stream, "<sv:value>{$val}</sv:value>");
         }
         fwrite($stream, "</sv:property>");
     }
     if (!$noRecurse) {
         foreach ($node as $child) {
             if (!($child->getDepth() == 1 && NodeHelper::isSystemItem($child))) {
                 self::exportSystemViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
             }
         }
     }
     fwrite($stream, '</sv:node>');
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:67,代码来源:ImportExport.php

示例5: isNodeType

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

示例6: setMixins

 private function setMixins(Mapping\ClassMetadata $metadata, NodeInterface $node)
 {
     if ($metadata->versionable === 'full') {
         $node->addMixin('mix:versionable');
     } else {
         if ($metadata->versionable === 'simple') {
             $node->addMixin('mix:simpleVersionable');
         }
         if ($metadata->referenceable) {
             $node->addMixin('mix:referenceable');
         }
     }
     // we manually set the uuid to allow creating referenced and referencing document without flush in between.
     if ($node->isNodeType('mix:referenceable') && !$node->hasProperty('jcr:uuid')) {
         // TODO do we need to check with the storage backend if the generated id really is unique?
         $node->setProperty('jcr:uuid', UUIDHelper::generateUUID());
     }
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:18,代码来源:UnitOfWork.php


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