Example #1
0
 /**
  * Appends a generice <index> or <unique> XML node to its parent node.
  *
  * @param string   $nodeType   The node type (index or unique)
  * @param Index    $index      The Index model instance
  * @param \DOMNode $parentNode The parent DOMNode object
  */
 private function appendGenericIndexNode($nodeType, Index $index, \DOMNode $parentNode)
 {
     $indexNode = $parentNode->appendChild($this->document->createElement($nodeType));
     $indexNode->setAttribute('name', $index->getName());
     foreach ($index->getColumns() as $columnName) {
         $indexColumnNode = $indexNode->appendChild($this->document->createElement($nodeType . '-column'));
         $indexColumnNode->setAttribute('name', $columnName);
         if ($size = $index->getColumnSize($columnName)) {
             $indexColumnNode->setAttribute('size', $size);
         }
     }
     foreach ($index->getVendorInformation() as $vendorInformation) {
         $this->appendVendorInformationNode($vendorInformation, $indexNode);
     }
 }