コード例 #1
0
 /**
  * Copies properties from a NodeTypeDefinition
  * @param   \PHPCR\NodeType\NodeTypeDefinitionInterface  $ntd    The node type definition to copy properties from
  */
 protected function fromNodeTypeDefinition(\PHPCR\NodeType\NodeTypeDefinitionInterface $ntd)
 {
     $this->name = $ntd->getName();
     $this->isAbstract = $ntd->isAbstract();
     $this->isMixin = $ntd->isMixin();
     $this->isQueryable = $ntd->isQueryable();
     $this->hasOrderableChildNodes = $ntd->hasOrderableChildNodes();
     $this->primaryItemName = $ntd->getPrimaryItemName();
     $this->declaredSuperTypeNames = $ntd->getDeclaredSupertypeNames();
     $this->declaredPropertyDefinitions = new ArrayObject($ntd->getDeclaredPropertyDefinitions());
     $this->declaredNodeDefinitions = new ArrayObject($ntd->getDeclaredChildNodeDefinitions());
 }
コード例 #2
0
ファイル: CndWriter.php プロジェクト: frogriotcom/phpcr-utils
 /**
  * A node type definition consists of a node type name followed by an optional
  * supertypes block, an optional node type attributes block and zero or more
  * blocks, each of which is either a property or child node definition.
  *
  *      NodeTypeDef ::= NodeTypeName [Supertypes]
  *          [NodeTypeAttribute {NodeTypeAttribute}]
  *          {PropertyDef | ChildNodeDef}
  */
 protected function writeNodeType(NodeTypeDefinitionInterface $nodeType)
 {
     $this->checkNamespace($nodeType->getName());
     $s = '[' . $nodeType->getName() . ']';
     if ($superTypes = $nodeType->getDeclaredSupertypeNames()) {
         foreach ($superTypes as $superType) {
             $this->checkNamespace($superType);
         }
         $s .= ' > ' . implode(', ', $superTypes);
     }
     $s .= "\n";
     $attributes = '';
     if ($nodeType->hasOrderableChildNodes()) {
         $attributes .= 'orderable ';
     }
     if ($nodeType->isMixin()) {
         $attributes .= 'mixin ';
     }
     if ($nodeType->isAbstract()) {
         $attributes .= 'abstract ';
     }
     $attributes .= $nodeType->isQueryable() ? 'query ' : 'noquery ';
     if ($nodeType->getPrimaryItemName()) {
         $attributes .= 'primaryitem ' . $nodeType->getPrimaryItemName() . ' ';
     }
     if ($attributes) {
         $s .= trim($attributes) . "\n";
     }
     $s .= $this->writeProperties($nodeType->getDeclaredPropertyDefinitions());
     $s .= $this->writeChildren($nodeType->getDeclaredChildNodeDefinitions());
     return $s;
 }