Exemple #1
0
 /**
  * Stores the node type in our internal structures (flat && tree)
  *
  * @param   \PHPCR\NodeType\NodeTypeInterface  $nodetype   The nodetype to add
  */
 protected function addNodeType(\PHPCR\NodeType\NodeTypeInterface $nodetype)
 {
     if ($nodetype->isMixin()) {
         $this->mixinTypes[$nodetype->getName()] = $nodetype;
     } else {
         $this->primaryTypes[$nodetype->getName()] = $nodetype;
     }
     $this->addToNodeTree($nodetype);
 }
 /**
  * Convert a node type into YAML format
  *
  * @param NodeTypeInterface
  *
  * @return string
  */
 public function serialize(NodeTypeInterface $nt)
 {
     $out = array('name' => $nt->getName(), 'declared_supertypes' => $nt->getDeclaredSupertypeNames(), 'abstract' => (bool) $nt->isAbstract(), 'mixin' => (bool) $nt->isMixin(), 'orderable_child_nodes' => (bool) $nt->hasOrderableChildNodes(), 'queryable' => (bool) $nt->isQueryable(), 'primary_item' => $nt->getPrimaryItemName(), 'properties' => array(), 'children' => array());
     foreach ($nt->getDeclaredPropertyDefinitions() as $pd) {
         $property = $this->getItemDefinitionArray($pd);
         $property = array_merge($property, array('required_type' => PropertyType::nameFromValue($pd->getRequiredType()), 'value_constraints' => $pd->getValueConstraints(), 'default_values' => $pd->getDefaultValues(), 'multiple' => (bool) $pd->isMultiple(), 'available_query_operators' => $pd->getAvailableQueryOperators(), 'full_text_searchable' => (bool) $pd->isFullTextSearchable(), 'query_orderable' => (bool) $pd->isQueryOrderable()));
         $out['properties'][] = $property;
     }
     foreach ($nt->getDeclaredChildNodeDefinitions() as $cd) {
         $child = $this->getItemDefinitionArray($cd);
         $child = array_merge($child, array('required_primary_types' => $cd->getRequiredPrimaryTypeNames(), 'default_primary_type' => $cd->getDefaultPrimaryTypeName(), 'same_name_siblings' => (bool) $cd->allowsSameNameSiblings()));
         $out['children'][] = $child;
     }
     return Yaml::dump($out, 10);
 }