private function loadAttributeGroup(Schema $schema, DOMElement $node)
 {
     $attGroup = new AttributeGroup($schema, $node->getAttribute("name"));
     $attGroup->setDoc($this->getDocumentation($node));
     $schema->addAttributeGroup($attGroup);
     return function () use($schema, $node, $attGroup) {
         foreach ($node->childNodes as $childNode) {
             switch ($childNode->localName) {
                 case 'attribute':
                     if ($childNode->hasAttribute("ref")) {
                         $attribute = $this->findSomething('findAttribute', $schema, $node, $childNode->getAttribute("ref"));
                     } else {
                         $attribute = $this->loadAttribute($schema, $childNode);
                     }
                     $attGroup->addAttribute($attribute);
                     break;
                 case 'attributeGroup':
                     $attribute = $this->findSomething('findAttributeGroup', $schema, $node, $childNode->getAttribute("ref"));
                     $attGroup->addAttribute($attribute);
                     break;
             }
         }
     };
 }
예제 #2
0
 private function visitAttributeGroup(PHPClass $class, Schema $schema, AttributeGroup $att)
 {
     foreach ($att->getAttributes() as $childAttr) {
         if ($childAttr instanceof AttributeGroup) {
             $this->visitAttributeGroup($class, $schema, $childAttr);
         } else {
             $property = $this->visitAttribute($class, $schema, $childAttr);
             $class->addProperty($property);
         }
     }
 }
예제 #3
0
 public function addAttributeGroup(AttributeGroup $group)
 {
     $this->attributeGroups[$group->getName()] = $group;
 }