Changeset 1410
- Timestamp:
- 06/09/06 15:31:55 (2 years ago)
- Files:
-
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php (modified) (68 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/NameFactory.php (modified) (5 diffs)
- trunk/lib/vendor/propel-generator/resources/xsd/database.xsd (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php
r1386 r1410 2 2 3 3 /* 4 * $Id: PHP5ComplexObjectBuilder.php 3 46 2006-03-01 16:46:49Z soenke$4 * $Id: PHP5ComplexObjectBuilder.php 378 2006-05-27 01:14:41Z hans $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 25 25 /** 26 26 * Generates a PHP5 base Object class with complex object model methods. 27 * 27 * 28 28 * This class adds on to the PHP5BasicObjectBuilder class by adding more complex 29 29 * logic related to relationships to methods like the setters, and save method. Also, 30 30 * new get*Join*() methods are added to fetch related rows. 31 * 31 * 32 32 * @author Hans Lellelid <hans@xmpl.org> 33 33 * @package propel.engine.builder.om.php5 34 34 */ 35 class PHP5ComplexObjectBuilder extends PHP5BasicObjectBuilder { 36 35 class PHP5ComplexObjectBuilder extends PHP5BasicObjectBuilder { 36 37 37 /** 38 38 * Adds additional attributes used for complex object model. … … 47 47 $table = $this->getTable(); 48 48 parent::addAttributes($script); 49 49 50 50 foreach ($table->getForeignKeys() as $fk) { 51 51 $this->addFKAttributes($script, $fk); 52 52 } 53 53 54 54 foreach($table->getReferrers() as $refFK) { 55 55 // if ($refFK->getTable()->getName() != $table->getName()) { … … 57 57 // } 58 58 } 59 59 60 60 $this->addAlreadyInSaveAttribute($script); 61 61 $this->addAlreadyInValidationAttribute($script); 62 62 } 63 63 64 64 /** 65 65 * Specifies the methods that are added as part of the basic OM class. … … 72 72 $table = $this->getTable(); 73 73 parent::addClassBody($script); 74 75 74 75 76 76 $this->addFKMethods($script); 77 77 $this->addRefFKMethods($script); 78 79 } 80 78 79 } 80 81 81 /** 82 82 * Adds the close of mutator (setter) method for a column. … … 92 92 $cfc=$col->getPhpName(); 93 93 $clo=strtolower($col->getName()); 94 94 95 95 if ($col->isForeignKey()) { 96 96 97 97 $tblFK = $table->getDatabase()->getTable($col->getRelatedTableName()); 98 98 $colFK = $tblFK->getColumn($col->getRelatedColumnName()); 99 99 100 100 $varName = $this->getFKVarName($col->getForeignKey()); 101 101 … … 103 103 if (\$this->$varName !== null && \$this->".$varName."->get".$colFK->getPhpName()."() !== \$v) { 104 104 \$this->$varName = null; 105 } 105 } 106 106 "; 107 107 } /* if col is foreign key */ 108 108 109 109 foreach ($col->getReferrers() as $fk) { 110 110 111 111 $tblFK = $this->getDatabase()->getTable($fk->getForeignTableName()); 112 112 113 113 if ( $tblFK->getName() != $table->getName() ) { 114 114 115 115 $collName = $this->getRefFKCollVarName($fk); 116 116 117 117 $tblFK = $table->getDatabase()->getTable($col->getRelatedTableName()); 118 118 $colFK = $tblFK->getColumn($col->getRelatedColumnName()); 119 119 120 120 $script .= " 121 121 … … 132 132 $script .= " 133 133 } // set$cfc() 134 "; 134 "; 135 135 } // addMutatorClose() 136 136 137 137 /** 138 138 * Adds the methods related to validating, saving and deleting the object. … … 145 145 $this->addDoSave($script); 146 146 } 147 147 148 148 /** 149 149 * Adds the methods related to validationg the object. … … 155 155 $this->addDoValidate($script); 156 156 } 157 157 158 158 /** 159 159 * Convenience method to get the foreign Table object for an fkey. … … 164 164 return $this->getTable()->getDatabase()->getTable($fk->getForeignTableName()); 165 165 } 166 166 167 167 /** 168 168 * Gets the PHP method name affix to be used for fkeys for the current table (not referrers to this table). 169 * 169 * 170 170 * The difference between this method and the getRefFKPhpNameAffix() method is that in this method the 171 171 * classname in the affix is the foreign table classname. 172 * 172 * 173 173 * @param ForeignKey $fk The local FK that we need a name for. 174 174 * @param boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj() … … 177 177 public function getFKPhpNameAffix(ForeignKey $fk, $plural = false) 178 178 { 179 $className = $this->getForeignTable($fk)->getPhpName(); 179 $className = $this->getForeignTable($fk)->getPhpName(); 180 180 return $className . ($plural ? 's' : '') . $this->getRelatedBySuffix($fk); 181 181 } 182 182 183 183 /** 184 184 * Gets the PHP method name affix to be used for referencing foreign key methods and variable names (e.g. set????(), $coll???). 185 * 185 * 186 186 * The difference between this method and the getFKPhpNameAffix() method is that in this method the 187 187 * classname in the affix is the classname of the local fkey table. 188 * 188 * 189 189 * @param ForeignKey $fk The referrer FK that we need a name for. 190 190 * @param boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj() … … 196 196 return $className . ($plural ? 's' : '') . $this->getRelatedBySuffix($fk); 197 197 } 198 198 199 199 /** 200 200 * Gets the "RelatedBy*" suffix (if needed) that is attached to method and variable names. 201 * 201 * 202 202 * The related by suffix is based on the local columns of the foreign key. If there is more than 203 * one column in a table that points to the same foreign table, then a 'RelatedByLocalColName' suffix 203 * one column in a table that points to the same foreign table, then a 'RelatedByLocalColName' suffix 204 204 * will be appended. 205 * 205 * 206 206 * @return string 207 207 */ … … 228 228 $relCol = "RelatedBy" . $relCol; 229 229 } 230 230 231 231 return $relCol; 232 } 233 232 } 233 234 234 protected function getFKVarName(ForeignKey $fk) 235 235 { 236 236 return 'a' . $this->getFKPhpNameAffix($fk, $plural = false); 237 237 } 238 238 239 239 protected function getRefFKCollVarName(ForeignKey $fk) 240 240 { 241 241 return 'coll' . $this->getRefFKPhpNameAffix($fk, $plural = true); 242 242 } 243 243 244 244 protected function getRefFKLastCriteriaVarName(ForeignKey $fk) 245 245 { 246 246 return 'last' . $this->getRefFKPhpNameAffix($fk, $plural = false) . 'Criteria'; 247 247 } 248 248 249 249 // ---------------------------------------------------------------- 250 250 // 251 251 // F K M E T H O D S 252 252 // 253 // ---------------------------------------------------------------- 253 // ---------------------------------------------------------------- 254 254 255 255 /** … … 258 258 */ 259 259 protected function addFKMethods(&$script) 260 { 260 { 261 261 foreach ($this->getTable()->getForeignKeys() as $fk) { 262 262 $this->addFKMutator($script, $fk); … … 264 264 } // foreach fk 265 265 } 266 266 267 267 /** 268 268 * Adds the class attributes that are needed to store fkey related objects. … … 273 273 $className = $this->getForeignTable($fk)->getPhpName(); 274 274 $varName = $this->getFKVarName($fk); 275 275 276 276 $script .= " 277 277 /** … … 281 281 "; 282 282 } 283 283 284 284 /** 285 285 * Adds the mutator (setter) method for setting an fkey related object. … … 292 292 $className = $this->getForeignTable($fk)->getPhpName(); 293 293 $varName = $this->getFKVarName($fk); 294 294 295 295 $script .= " 296 296 /** … … 317 317 } 318 318 "; 319 319 320 320 } /* foreach local col */ 321 321 … … 326 326 "; 327 327 } 328 328 329 329 /** 330 330 * Adds the accessor (getter) method for getting an fkey related object. … … 334 334 { 335 335 $table = $this->getTable(); 336 336 337 337 $className = $this->getForeignTable($fk)->getPhpName(); 338 338 $varName = $this->getFKVarName($fk); 339 339 340 340 $and = ""; 341 341 $comma = ""; … … 347 347 $cptype = $column->getPhpNative(); 348 348 $clo = strtolower($column->getName()); 349 349 350 350 // FIXME: is this correct? what about negative numbers? 351 351 if ($cptype == "integer" || $cptype == "float" || $cptype == "double") { … … 363 363 364 364 $pCollName = $this->getFKPhpNameAffix($fk, $plural = true); 365 365 366 366 $fkPeerBuilder = OMBuilder::getNewPeerBuilder($this->getForeignTable($fk)); 367 367 368 368 $script .= " 369 369 … … 381 381 382 382 if (\$this->$varName === null && ($conditional)) { 383 "; 383 "; 384 384 $script .= " 385 385 \$this->$varName = ".$fkPeerBuilder->getPeerClassname()."::".$fkPeerBuilder->getRetrieveMethodName()."($arglist, \$con); 386 386 387 387 /* The following can be used instead of the line above to 388 388 guarantee the related object contains a reference … … 400 400 401 401 } // addFKAccessor 402 402 403 403 /** 404 404 * Adds a convenience method for setting a related object by specifying the primary key. … … 410 410 { 411 411 $table = $this->getTable(); 412 412 413 413 #$className = $this->getForeignTable($fk)->getPhpName(); 414 414 $methodAffix = $this->getFKPhpNameAffix($fk); 415 415 #$varName = $this->getFKVarName($fk); 416 416 417 417 $script .= " 418 418 /** … … 459 459 "; 460 460 } // addFKByKeyMutator() 461 461 462 462 /** 463 463 * Adds the method that fetches fkey-related (referencing) objects but also joins in data from another table. … … 468 468 $table = $this->getTable(); 469 469 $tblFK = $refFK->getTable(); 470 470 471 471 $relCol = $this->getRefFKPhpNameAffix($refFK, $plural=true); 472 472 $collName = $this->getRefFKCollVarName($refFK); 473 473 $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 474 474 475 475 $fkPeerBuilder = OMBuilder::getNewPeerBuilder($tblFK); 476 476 477 477 $lastTable = ""; 478 478 foreach ($tblFK->getForeignKeys() as $fk2) { 479 479 480 480 // Add join methods if the fk2 table is not this table or 481 481 // the fk2 table references this table multiple times. 482 482 483 483 $doJoinGet = true; 484 484 485 485 if ( $fk2->getForeignTableName() == $table->getName() ) { 486 486 $doJoinGet = false; … … 502 502 $doJoinGet = false; 503 503 } 504 504 505 505 $relCol2 = $this->getFKPhpNameAffix($fk2, $plural = false); 506 506 507 if ( $this->getRelatedBySuffix($refFK) != "" && 507 if ( $this->getRelatedBySuffix($refFK) != "" && 508 508 ($this->getRelatedBySuffix($refFK) == $this->getRelatedBySuffix($fk2))) { 509 509 $doJoinGet = false; … … 555 555 "; 556 556 } // end foreach ($fk->getForeignColumns() 557 557 558 558 $script .= " 559 559 \$this->$collName = ".$fkPeerBuilder->getPeerClassname()."::doSelectJoin$relCol2(\$criteria, \$con); … … 573 573 "; 574 574 } /* end foreach ($fk->getForeignColumns() */ 575 575 576 576 $script .= " 577 577 if (!isset(\$this->$lastCriteriaName) || !\$this->".$lastCriteriaName."->equals(\$criteria)) { … … 587 587 588 588 } /* end foreach ($tblFK->getForeignKeys() as $fk2) { */ 589 589 590 590 } // function 591 592 591 592 593 593 // ---------------------------------------------------------------- 594 594 // 595 595 // R E F E R R E R F K M E T H O D S 596 596 // 597 // ---------------------------------------------------------------- 598 597 // ---------------------------------------------------------------- 598 599 599 /** 600 600 * Adds the attributes used to store objects that have referrer fkey relationships to this object. … … 607 607 $collName = $this->getRefFKCollVarName($refFK); 608 608 $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 609 609 610 610 $script .= " 611 611 /** … … 614 614 */ 615 615 protected $".$collName."; 616 616 617 617 /** 618 618 * The criteria used to select the current contents of $collName. 619 619 * @var Criteria 620 620 */ 621 pr ivate\$".$lastCriteriaName." = null;622 "; 623 } 624 621 protected \$".$lastCriteriaName." = null; 622 "; 623 } 624 625 625 /** 626 626 * Adds the methods for retrieving, initializing, adding objects that are related to this one by foreign keys. … … 639 639 } 640 640 } 641 641 642 642 /** 643 643 * Adds the method that initializes the referrer fkey collection. … … 645 645 */ 646 646 protected function addRefFKInit(&$script, ForeignKey $refFK) { 647 647 648 648 $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 649 649 $collName = $this->getRefFKCollVarName($refFK); 650 650 651 651 $script .= " 652 652 /** … … 664 664 "; 665 665 } // addRefererInit() 666 666 667 667 /** 668 668 * Adds the method that adds an object into the referrer fkey collection. … … 673 673 $tblFK = $refFK->getTable(); 674 674 $className = $refFK->getTable()->getPhpName(); 675 675 676 676 $joinedTableObjectBuilder = OMBuilder::getNewObjectBuilder($refFK->getTable()); 677 677 678 678 $script .= " 679 679 /** … … 692 692 "; 693 693 } // addRefererAdd 694 694 695 695 /** 696 696 * Adds the method that returns the size of the referrer fkey collection. … … 700 700 { 701 701 $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 702 702 703 703 $fkPeerBuilder = OMBuilder::getNewPeerBuilder($refFK->getTable()); 704 704 705 705 $script .= " 706 706 /** … … 738 738 "; 739 739 } // addRefererCount 740 740 741 741 /** 742 742 * Adds the method that returns the referrer fkey collection. 743 743 * @param string &$script The script will be modified in this method. 744 744 */ 745 protected function addRefFKGet(&$script, ForeignKey $refFK) 745 protected function addRefFKGet(&$script, ForeignKey $refFK) 746 746 { 747 747 $table = $this->getTable(); 748 748 $tblFK = $refFK->getTable(); 749 749 750 750 $fkPeerBuilder = OMBuilder::getNewPeerBuilder($refFK->getTable()); 751 751 $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 752 752 753 753 $collName = $this->getRefFKCollVarName($refFK); 754 754 $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 755 755 756 756 $script .= " 757 757 /** … … 784 784 \$this->$collName = array(); 785 785 } else { 786 "; 786 "; 787 787 foreach ($refFK->getLocalColumns() as $colFKName) { 788 788 // $colFKName is local to the referring table (i.e. foreign to this table) 789 789 $lfmap = $refFK->getLocalForeignMapping(); 790 $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 790 $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 791 791 $colFK = $refFK->getTable()->getColumn($colFKName); 792 792 793 793 $script .= " 794 794 \$criteria->add(".$fkPeerBuilder->getColumnConstant($colFK).", \$this->get".$localColumn->getPhpName()."()); 795 795 "; 796 796 } // end foreach ($fk->getForeignColumns() 797 797 798 798 $script .= " 799 799 ".$fkPeerBuilder->getPeerClassname()."::addSelectColumns(\$criteria); … … 810 810 // $colFKName is local to the referring table (i.e. foreign to this table) 811 811 $lfmap = $refFK->getLocalForeignMapping(); 812 $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 812 $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 813 813 $colFK = $refFK->getTable()->getColumn($colFKName); 814 814 $script .= " … … 829 829 "; 830 830 } // addRefererGet() 831 832 833 831 832 833 834 834 // ---------------------------------------------------------------- 835 835 // 836 836 // M A N I P U L A T I O N M E T H O D S 837 837 // 838 // ---------------------------------------------------------------- 839 838 // ---------------------------------------------------------------- 839 840 840 /** 841 841 * Adds the workhourse doSave() method. … … 845 845 { 846 846 $table = $this->getTable(); 847 847 848 848 $script .= " 849 849 /** 850 850 * Stores the object in the database. 851 * 851 * 852 852 * If the object is new, it inserts it; otherwise an update is performed. 853 853 * All related objects are also updated in this method. … … 860 860 protected function doSave(\$con) 861 861 { 862 \$affectedRows = 0; // initialize var to track total num of affected rows 862 \$affectedRows = 0; // initialize var to track total num of affected rows 863 863 if (!\$this->alreadyInSave) { 864 864 \$this->alreadyInSave = true; 865 865 "; 866 866 867 867 if (count($table->getForeignKeys())) { 868 868 869 869 $script .= " 870 870 … … 874 874 // foreign key reference. 875 875 "; 876 876 877 877 foreach($table->getForeignKeys() as $fk) 878 878 { … … 888 888 } // foreach foreign k 889 889 } // if (count(foreign keys)) 890 891 $script .= " 890 891 $script .= " 892 892 893 893 // If this object has been modified, then save it to the database. 894 894 if (\$this->isModified()"; 895 895 896 896 /* 897 897 FIXME: this doesn't work right now because the BasePeer::doInsert() method … … 902 902 } 903 903 */ 904 904 905 905 $script .= ") { 906 906 if (\$this->isNew()) { 907 907 \$pk = ".$this->getPeerClassname()."::doInsert(\$this, \$con); 908 \$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which 909 // should always be true here (even though technically 908 \$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which 909 // should always be true here (even though technically 910 910 // BasePeer::doInsert() can insert multiple rows). 911 911 "; 912 912 if ($table->getIdMethod() != IDMethod::NO_ID_METHOD) { 913 913 914 914 if (count($pks = $table->getPrimaryKey())) { 915 915 foreach ($pks as $pk) { … … 922 922 } 923 923 } // if (id method != "none") 924 924 925 925 $script .= " 926 926 \$this->setNew(false); … … 955 955 } // doSave() 956 956 "; 957 958 } 959 957 958 } 959 960 960 /** 961 961 * Adds the $alreadyInSave attribute, which prevents attempting to re-save the same object. … … 973 973 "; 974 974 } 975 975 976 976 /** 977 977 * Adds the save() method. … … 1000 1000 \$con = Propel::getConnection(".$this->getPeerClassname()."::DATABASE_NAME); 1001 1001 } 1002 1002 1003 1003 try { 1004 1004 \$con->begin(); … … 1012 1012 } 1013 1013 "; 1014 1015 } 1016 1014 1015 } 1016 1017 1017 /** 1018 1018 * Adds the $alreadyInValidation attribute, which prevents attempting to re-validate the same object. … … 1030 1030 "; 1031 1031 } 1032 1032 1033 1033 /** 1034 1034 * Adds the validate() method. … … 1062 1062 "; 1063 1063 } // addValidate() 1064 1064 1065 1065 /** 1066 1066 * Adds the workhourse doValidate() method. … … 1070 1070 { 1071 1071 $table = $this->getTable(); 1072 1072 1073 1073 $script .= " 1074 1074 /** … … 1109 1109 } /* for() */ 1110 1110 } /* if count(fkeys) */ 1111 1111 1112 1112 $script .= " 1113 1113 … … 1133 1133 } /* if tableFK !+ table */ 1134 1134 } /* foreach getReferrers() */ 1135 1135 1136 1136 $script .= " 1137 1137 … … 1143 1143 "; 1144 1144 } // addDoValidate() 1145 1145 1146 1146 /** 1147 1147 * Adds the copy() method, which (in complex OM) includes the $deepCopy param for making copies of related objects. … … 1151 1151 { 1152 1152 $this->addCopyInto($script); 1153 1153 1154 1154 $table = $this->getTable(); 1155 1155 … … 1159 1159 * It creates a new object filling in the simple attributes, but skipping any primary 1160 1160 * keys that are defined for the table. 1161 * 1161 * 1162 1162 * If desired, this method can also make copies of all associated (fkey referrers) 1163 1163 * objects. … … 1177 1177 "; 1178 1178 } // addCopy() 1179 1179 1180 1180 /** 1181 1181 * Adds the copyInto() method, which takes an object and sets contents to match current object. … … 1190 1190 /** 1191 1191 * Sets contents of passed object to values from current object. 1192 * 1192 * 1193 1193 * If desired, this method can also make copies of all associated (fkey referrers) 1194 1194 * objects. … … 1238 1238 } 1239 1239 "; 1240 }1241 $script .= "1240 } 1241 $script .= " 1242 1242 \$copyObj->add".$this->getRefFKPhpNameAffix($fk)."(\$relObj->copy(\$deepCopy)); 1243 1243 } … … 1250 1250 "; 1251 1251 } /* if (count referrers > 0 ) */ 1252 1252 1253 1253 $script .= " 1254 1254 … … 1270 1270 "; 1271 1271 } // addCopyInto() 1272 1272 1273 1273 } // PHP5ComplexObjectBuilder trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/NameFactory.php
r497 r1410 2 2 3 3 /* 4 * $Id: NameFactory.php 289 2005-11-27 19:13:01Z hans $4 * $Id: NameFactory.php 366 2006-05-23 13:00:30Z hans $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 29 29 * @author Hans Lellelid <hans@xmpl.org> (Propel) 30 30 * @author Daniel Rall <dlr@finemaltcoding.com> (Torque) 31 * @version $Revision: 289$31 * @version $Revision: 366 $ 32 32 * @package propel.engine.database.model 33 33 */ … … 63 63 } 64 64 65 private function instance()65 private static function instance() 66 66 { 67 67 if (self::$instance === null) { … … 79 79 protected function getAlgorithm($name) 80 80 { 81 // synchronized (algorithms) 82 $algorithm = @$this->algorithms[$name]; 81 $algorithm = isset($this->algorithms[$name]) ? $this->algorithms[$name] : null; 83 82 if ($algorithm === null) { 84 83 try { … … 110 109 * @throws EngineException 111 110 */ 112 public function generateName($algorithmName, $inputs)111 public static function generateName($algorithmName, $inputs) 113 112 { 114 113 $algorithm = self::instance()->getAlgorithm($algorithmName); trunk/lib/vendor/propel-generator/resources/xsd/database.xsd
r1310 r1410 15 15 16 16 <xs:element name="database" type="database"/> 17 <xs:element name="vendor" type="vendor"/> 17 18 18 19 <xs:simpleType name="file"> … … 218 219 219 220 <xs:complexType name="index"> 220 <xs: sequence>221 <xs:choice maxOccurs="unbounded"> 221 222 <xs:element name="index-column" type="index-column" minOccurs="1" maxOccurs="unbounded"/> 222 </xs:sequence> 223 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 224 </xs:choice> 223 225 <xs:attribute name="name" type="index_name" use="optional"/> 224 226 </xs:complexType> 225 227 226 228 <xs:complexType name="unique"> 227 <xs: sequence>229 <xs:choice maxOccurs="unbounded"> 228 230 <xs:element name="unique-column" type="unique-column" minOccurs="1" maxOccurs="unbounded"/> 229 </xs:sequence> 231 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 232 </xs:choice> 230 233 <xs:attribute name="name" type="index_name" use="optional"/> 231 234 </xs:complexType> … … 233 236 <xs:complexType name="index-column"> 234 237 <xs:sequence> 235 <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/>238 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 236 239 </xs:sequence> 237 240 <xs:attribute name="name" type="column_name" use="required"/> … … 241 244 <xs:complexType name="unique-column"> 242 245 <xs:sequence> 243 <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/>246 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 244 247 </xs:sequence> 245 248 <xs:attribute name="name" type="column_name" use="required"/> … … 260 263 261 264 <xs:complexType name="column"> 262 <xs: sequence>265 <xs:choice maxOccurs="unbounded"> 263 266 <xs:element name="inheritance" type="inheritance" minOccurs="0" maxOccurs="unbounded"/> 264 <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/>265 </xs: sequence>267 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 268 </xs:choice> 266 269 <xs:attribute name="name" type="column_name" use="required"/> 267 270 <xs:attribute name="phpName" type="php_name" use="optional"/> … … 286 289 287 290 <xs:complexType name="foreign-key"> 288 <xs: sequence>291 <xs:choice maxOccurs="unbounded"> 289 292 <xs:element name="reference" type="reference" minOccurs="1" maxOccurs="unbounded"/> 290 <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/>291 </xs: sequence>293 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 294 </xs:choice> 292 295 <xs:attribute name="foreignTable" type="table_name" use="required"/> 293 296 <xs:attribute name="name" type="foreign_name" use="optional"/> … … 301 304 302 305 <xs:complexType name="table"> 303 <xs: sequence>306 <xs:choice maxOccurs="unbounded"> 304 307 <xs:element name="column" type="column" maxOccurs="unbounded"/> 305 308 <xs:element name="foreign-key" type="foreign-key" minOccurs="0" maxOccurs="unbounded"/> … … 308 311 <xs:element name="id-method-parameter" type="id-method-parameter" minOccurs="0" maxOccurs="unbounded"/> 309 312 <xs:element name="validator" type="validator" minOccurs="0" maxOccurs="unbounded"/> 310 <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/>311 </xs: sequence>313 <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 314 </xs:choice> 312 315 <xs:attribute name="name" type="table_name" use="required"/> 313 316 <xs:attribute name="phpName" type="php_class" use="optional"/> … … 328 331 329 332 <xs:complexType name="database"> 330 <xs: sequence>333 <xs:choice maxOccurs="unbounded"> 331 334 <xs:element name="external-schema" type="external-schema" minOccurs="0" maxOccurs="unbounded"/> 332 335 <xs:element name="table" type="table" minOccurs="1" maxOccurs="unbounded"/> 333 </xs: sequence>336 </xs:choice> 334 337 <xs:attribute name="name" type="xs:string" use="optional"/> 335 338 <xs:attribute name="defaultIdMethod" type="dbidmethod" default="none"/>