Development

Changeset 1410

You must first sign up to be able to contribute.

Changeset 1410

Show
Ignore:
Timestamp:
06/09/06 15:31:55 (2 years ago)
Author:
fabien
Message:

updated Propel to 1.2.0RC2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php

    r1386 r1410  
    22 
    33/* 
    4  *  $Id: PHP5ComplexObjectBuilder.php 346 2006-03-01 16:46:49Z soenke
     4 *  $Id: PHP5ComplexObjectBuilder.php 378 2006-05-27 01:14:41Z hans
    55 * 
    66 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     
    2525/** 
    2626 * Generates a PHP5 base Object class with complex object model methods. 
    27  *  
     27 * 
    2828 * This class adds on to the PHP5BasicObjectBuilder class by adding more complex 
    2929 * logic related to relationships to methods like the setters, and save method. Also, 
    3030 * new get*Join*() methods are added to fetch related rows. 
    31  *  
     31 * 
    3232 * @author Hans Lellelid <hans@xmpl.org> 
    3333 * @package propel.engine.builder.om.php5 
    3434 */ 
    35 class PHP5ComplexObjectBuilder extends PHP5BasicObjectBuilder {     
    36    
     35class PHP5ComplexObjectBuilder extends PHP5BasicObjectBuilder { 
     36 
    3737  /** 
    3838   * Adds additional attributes used for complex object model. 
     
    4747    $table = $this->getTable(); 
    4848    parent::addAttributes($script); 
    49      
     49 
    5050    foreach ($table->getForeignKeys() as $fk) { 
    5151      $this->addFKAttributes($script, $fk); 
    5252    } 
    53      
     53 
    5454    foreach($table->getReferrers() as $refFK) { 
    5555      // if ($refFK->getTable()->getName() != $table->getName()) { 
     
    5757      // } 
    5858    } 
    59      
     59 
    6060    $this->addAlreadyInSaveAttribute($script); 
    6161    $this->addAlreadyInValidationAttribute($script); 
    6262  } 
    63    
     63 
    6464  /** 
    6565   * Specifies the methods that are added as part of the basic OM class. 
     
    7272    $table = $this->getTable(); 
    7373    parent::addClassBody($script); 
    74      
    75      
     74 
     75 
    7676    $this->addFKMethods($script); 
    7777    $this->addRefFKMethods($script); 
    78      
    79   } 
    80    
     78 
     79  } 
     80 
    8181  /** 
    8282   * Adds the close of mutator (setter) method for a column. 
     
    9292    $cfc=$col->getPhpName(); 
    9393    $clo=strtolower($col->getName()); 
    94      
     94 
    9595    if ($col->isForeignKey()) { 
    96      
     96 
    9797      $tblFK = $table->getDatabase()->getTable($col->getRelatedTableName()); 
    9898      $colFK = $tblFK->getColumn($col->getRelatedColumnName()); 
    99        
     99 
    100100      $varName = $this->getFKVarName($col->getForeignKey()); 
    101101 
     
    103103    if (\$this->$varName !== null && \$this->".$varName."->get".$colFK->getPhpName()."() !== \$v) { 
    104104      \$this->$varName = null; 
    105     }     
     105    } 
    106106"; 
    107107    } /* if col is foreign key */ 
    108108 
    109109    foreach ($col->getReferrers() as $fk) { 
    110        
     110 
    111111      $tblFK = $this->getDatabase()->getTable($fk->getForeignTableName()); 
    112        
     112 
    113113      if ( $tblFK->getName() != $table->getName() ) { 
    114        
     114 
    115115        $collName = $this->getRefFKCollVarName($fk); 
    116                  
     116 
    117117        $tblFK = $table->getDatabase()->getTable($col->getRelatedTableName()); 
    118118        $colFK = $tblFK->getColumn($col->getRelatedColumnName()); 
    119        
     119 
    120120        $script .= " 
    121121 
     
    132132    $script .= " 
    133133  } // set$cfc() 
    134 ";      
     134"; 
    135135  } // addMutatorClose() 
    136    
     136 
    137137  /** 
    138138   * Adds the methods related to validating, saving and deleting the object. 
     
    145145    $this->addDoSave($script); 
    146146  } 
    147    
     147 
    148148  /** 
    149149   * Adds the methods related to validationg the object. 
     
    155155    $this->addDoValidate($script); 
    156156  } 
    157    
     157 
    158158  /** 
    159159   * Convenience method to get the foreign Table object for an fkey. 
     
    164164    return $this->getTable()->getDatabase()->getTable($fk->getForeignTableName()); 
    165165  } 
    166    
     166 
    167167  /** 
    168168   * Gets the PHP method name affix to be used for fkeys for the current table (not referrers to this table). 
    169    *  
     169   * 
    170170   * The difference between this method and the getRefFKPhpNameAffix() method is that in this method the 
    171171   * classname in the affix is the foreign table classname. 
    172    *  
     172   * 
    173173   * @param ForeignKey $fk The local FK that we need a name for. 
    174174   * @param boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj() 
     
    177177  public function getFKPhpNameAffix(ForeignKey $fk, $plural = false) 
    178178  { 
    179     $className = $this->getForeignTable($fk)->getPhpName();         
     179    $className = $this->getForeignTable($fk)->getPhpName(); 
    180180    return $className . ($plural ? 's' : '') . $this->getRelatedBySuffix($fk); 
    181181  } 
    182    
     182 
    183183  /** 
    184184   * Gets the PHP method name affix to be used for referencing foreign key methods and variable names (e.g. set????(), $coll???). 
    185    *  
     185   * 
    186186   * The difference between this method and the getFKPhpNameAffix() method is that in this method the 
    187187   * classname in the affix is the classname of the local fkey table. 
    188    *  
     188   * 
    189189   * @param ForeignKey $fk The referrer FK that we need a name for. 
    190190   * @param boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj() 
     
    196196    return $className . ($plural ? 's' : '') . $this->getRelatedBySuffix($fk); 
    197197  } 
    198    
     198 
    199199  /** 
    200200   * Gets the "RelatedBy*" suffix (if needed) that is attached to method and variable names. 
    201    *  
     201   * 
    202202   * 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 
    204204   * will be appended. 
    205    *  
     205   * 
    206206   * @return string 
    207207   */ 
     
    228228      $relCol = "RelatedBy" . $relCol; 
    229229    } 
    230      
     230 
    231231    return $relCol; 
    232   }   
    233    
     232  } 
     233 
    234234  protected function getFKVarName(ForeignKey $fk) 
    235235  { 
    236236    return 'a' . $this->getFKPhpNameAffix($fk, $plural = false); 
    237237  } 
    238    
     238 
    239239  protected function getRefFKCollVarName(ForeignKey $fk) 
    240240  { 
    241241    return 'coll' . $this->getRefFKPhpNameAffix($fk, $plural = true); 
    242242  } 
    243    
     243 
    244244  protected function getRefFKLastCriteriaVarName(ForeignKey $fk) 
    245245  { 
    246246    return 'last' . $this->getRefFKPhpNameAffix($fk, $plural = false) . 'Criteria'; 
    247247  } 
    248    
     248 
    249249  // ---------------------------------------------------------------- 
    250250  // 
    251251  // F K    M E T H O D S 
    252252  // 
    253   // ----------------------------------------------------------------   
     253  // ---------------------------------------------------------------- 
    254254 
    255255  /** 
     
    258258   */ 
    259259  protected function addFKMethods(&$script) 
    260   {   
     260  { 
    261261    foreach ($this->getTable()->getForeignKeys() as $fk) { 
    262262      $this->addFKMutator($script, $fk); 
     
    264264    } // foreach fk 
    265265  } 
    266    
     266 
    267267  /** 
    268268   * Adds the class attributes that are needed to store fkey related objects. 
     
    273273    $className = $this->getForeignTable($fk)->getPhpName(); 
    274274    $varName = $this->getFKVarName($fk); 
    275      
     275 
    276276    $script .= " 
    277277  /** 
     
    281281"; 
    282282  } 
    283    
     283 
    284284  /** 
    285285   * Adds the mutator (setter) method for setting an fkey related object. 
     
    292292    $className = $this->getForeignTable($fk)->getPhpName(); 
    293293    $varName = $this->getFKVarName($fk); 
    294      
     294 
    295295    $script .= " 
    296296  /** 
     
    317317    } 
    318318"; 
    319    
     319 
    320320      } /* foreach local col */ 
    321321 
     
    326326"; 
    327327  } 
    328    
     328 
    329329  /** 
    330330   * Adds the accessor (getter) method for getting an fkey related object. 
     
    334334  { 
    335335    $table = $this->getTable(); 
    336      
     336 
    337337    $className = $this->getForeignTable($fk)->getPhpName(); 
    338338    $varName = $this->getFKVarName($fk); 
    339      
     339 
    340340    $and = ""; 
    341341    $comma = ""; 
     
    347347      $cptype = $column->getPhpNative(); 
    348348      $clo = strtolower($column->getName()); 
    349        
     349 
    350350      // FIXME: is this correct? what about negative numbers? 
    351351      if ($cptype == "integer" || $cptype == "float" || $cptype == "double") { 
     
    363363 
    364364    $pCollName = $this->getFKPhpNameAffix($fk, $plural = true); 
    365      
     365 
    366366    $fkPeerBuilder = OMBuilder::getNewPeerBuilder($this->getForeignTable($fk)); 
    367      
     367 
    368368    $script .= " 
    369369 
     
    381381 
    382382    if (\$this->$varName === null && ($conditional)) { 
    383 ";    
     383"; 
    384384    $script .= " 
    385385      \$this->$varName = ".$fkPeerBuilder->getPeerClassname()."::".$fkPeerBuilder->getRetrieveMethodName()."($arglist, \$con); 
    386            
     386 
    387387      /* The following can be used instead of the line above to 
    388388         guarantee the related object contains a reference 
     
    400400 
    401401  } // addFKAccessor 
    402    
     402 
    403403  /** 
    404404   * Adds a convenience method for setting a related object by specifying the primary key. 
     
    410410  { 
    411411    $table = $this->getTable(); 
    412      
     412 
    413413    #$className = $this->getForeignTable($fk)->getPhpName(); 
    414414    $methodAffix = $this->getFKPhpNameAffix($fk); 
    415415    #$varName = $this->getFKVarName($fk); 
    416      
     416 
    417417    $script .= " 
    418418  /** 
     
    459459"; 
    460460  } // addFKByKeyMutator() 
    461    
     461 
    462462  /** 
    463463   * Adds the method that fetches fkey-related (referencing) objects but also joins in data from another table. 
     
    468468    $table = $this->getTable(); 
    469469    $tblFK = $refFK->getTable(); 
    470      
     470 
    471471    $relCol = $this->getRefFKPhpNameAffix($refFK, $plural=true); 
    472472    $collName = $this->getRefFKCollVarName($refFK); 
    473473    $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 
    474      
     474 
    475475    $fkPeerBuilder = OMBuilder::getNewPeerBuilder($tblFK); 
    476      
     476 
    477477    $lastTable = ""; 
    478478    foreach ($tblFK->getForeignKeys() as $fk2) { 
    479      
     479 
    480480      // Add join methods if the fk2 table is not this table or 
    481481      // the fk2 table references this table multiple times. 
    482482 
    483483      $doJoinGet = true; 
    484        
     484 
    485485      if ( $fk2->getForeignTableName() == $table->getName() ) { 
    486486        $doJoinGet = false; 
     
    502502        $doJoinGet = false; 
    503503      } 
    504        
     504 
    505505      $relCol2 = $this->getFKPhpNameAffix($fk2, $plural = false); 
    506506 
    507       if ( $this->getRelatedBySuffix($refFK) != "" &&  
     507      if ( $this->getRelatedBySuffix($refFK) != "" && 
    508508              ($this->getRelatedBySuffix($refFK) == $this->getRelatedBySuffix($fk2))) { 
    509509        $doJoinGet = false; 
     
    555555"; 
    556556        } // end foreach ($fk->getForeignColumns() 
    557      
     557 
    558558        $script .= " 
    559559        \$this->$collName = ".$fkPeerBuilder->getPeerClassname()."::doSelectJoin$relCol2(\$criteria, \$con); 
     
    573573"; 
    574574        } /* end foreach ($fk->getForeignColumns() */ 
    575        
     575 
    576576        $script .= " 
    577577      if (!isset(\$this->$lastCriteriaName) || !\$this->".$lastCriteriaName."->equals(\$criteria)) { 
     
    587587 
    588588    } /* end foreach ($tblFK->getForeignKeys() as $fk2) { */ 
    589    
     589 
    590590  } // function 
    591    
    592    
     591 
     592 
    593593  // ---------------------------------------------------------------- 
    594594  // 
    595595  // R E F E R R E R    F K    M E T H O D S 
    596596  // 
    597   // ----------------------------------------------------------------   
    598    
     597  // ---------------------------------------------------------------- 
     598 
    599599  /** 
    600600   * Adds the attributes used to store objects that have referrer fkey relationships to this object. 
     
    607607    $collName = $this->getRefFKCollVarName($refFK); 
    608608    $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 
    609      
     609 
    610610    $script .= " 
    611611  /** 
     
    614614   */ 
    615615  protected $".$collName."; 
    616    
     616 
    617617  /** 
    618618   * The criteria used to select the current contents of $collName. 
    619619   * @var Criteria 
    620620   */ 
    621   private \$".$lastCriteriaName." = null; 
    622 "; 
    623   } 
    624    
     621  protected \$".$lastCriteriaName." = null; 
     622"; 
     623  } 
     624 
    625625  /** 
    626626   * Adds the methods for retrieving, initializing, adding objects that are related to this one by foreign keys. 
     
    639639    } 
    640640  } 
    641    
     641 
    642642  /** 
    643643   * Adds the method that initializes the referrer fkey collection. 
     
    645645   */ 
    646646  protected function addRefFKInit(&$script, ForeignKey $refFK) { 
    647    
     647 
    648648    $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 
    649649    $collName = $this->getRefFKCollVarName($refFK); 
    650      
     650 
    651651    $script .= " 
    652652  /** 
     
    664664"; 
    665665  } // addRefererInit() 
    666    
     666 
    667667  /** 
    668668   * Adds the method that adds an object into the referrer fkey collection. 
     
    673673    $tblFK = $refFK->getTable(); 
    674674    $className = $refFK->getTable()->getPhpName(); 
    675      
     675 
    676676    $joinedTableObjectBuilder = OMBuilder::getNewObjectBuilder($refFK->getTable()); 
    677      
     677 
    678678    $script .= " 
    679679  /** 
     
    692692"; 
    693693  } // addRefererAdd 
    694    
     694 
    695695  /** 
    696696   * Adds the method that returns the size of the referrer fkey collection. 
     
    700700  { 
    701701    $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 
    702      
     702 
    703703    $fkPeerBuilder = OMBuilder::getNewPeerBuilder($refFK->getTable()); 
    704      
     704 
    705705    $script .= " 
    706706  /** 
     
    738738"; 
    739739  } // addRefererCount 
    740    
     740 
    741741  /** 
    742742   * Adds the method that returns the referrer fkey collection. 
    743743   * @param string &$script The script will be modified in this method. 
    744744   */ 
    745   protected function addRefFKGet(&$script, ForeignKey $refFK)  
     745  protected function addRefFKGet(&$script, ForeignKey $refFK) 
    746746  { 
    747747    $table = $this->getTable(); 
    748748    $tblFK = $refFK->getTable(); 
    749      
     749 
    750750    $fkPeerBuilder = OMBuilder::getNewPeerBuilder($refFK->getTable()); 
    751751    $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true); 
    752      
     752 
    753753    $collName = $this->getRefFKCollVarName($refFK); 
    754754    $lastCriteriaName = $this->getRefFKLastCriteriaVarName($refFK); 
    755      
     755 
    756756    $script .= " 
    757757  /** 
     
    784784         \$this->$collName = array(); 
    785785      } else { 
    786 ";  
     786"; 
    787787    foreach ($refFK->getLocalColumns() as $colFKName) { 
    788788      // $colFKName is local to the referring table (i.e. foreign to this table) 
    789789      $lfmap = $refFK->getLocalForeignMapping(); 
    790       $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]);      
     790      $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 
    791791      $colFK = $refFK->getTable()->getColumn($colFKName); 
    792        
     792 
    793793      $script .= " 
    794794        \$criteria->add(".$fkPeerBuilder->getColumnConstant($colFK).", \$this->get".$localColumn->getPhpName()."()); 
    795795"; 
    796796    } // end foreach ($fk->getForeignColumns() 
    797      
     797 
    798798    $script .= " 
    799799        ".$fkPeerBuilder->getPeerClassname()."::addSelectColumns(\$criteria); 
     
    810810      // $colFKName is local to the referring table (i.e. foreign to this table) 
    811811      $lfmap = $refFK->getLocalForeignMapping(); 
    812       $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]);      
     812      $localColumn = $this->getTable()->getColumn($lfmap[$colFKName]); 
    813813      $colFK = $refFK->getTable()->getColumn($colFKName); 
    814814      $script .= " 
     
    829829"; 
    830830  } // addRefererGet() 
    831    
    832    
    833    
     831 
     832 
     833 
    834834  // ---------------------------------------------------------------- 
    835835  // 
    836836  // M A N I P U L A T I O N    M E T H O D S 
    837837  // 
    838   // ----------------------------------------------------------------   
    839    
     838  // ---------------------------------------------------------------- 
     839 
    840840  /** 
    841841   * Adds the workhourse doSave() method. 
     
    845845  { 
    846846    $table = $this->getTable(); 
    847      
     847 
    848848    $script .= " 
    849849  /** 
    850850   * Stores the object in the database. 
    851    *  
     851   * 
    852852   * If the object is new, it inserts it; otherwise an update is performed. 
    853853   * All related objects are also updated in this method. 
     
    860860  protected function doSave(\$con) 
    861861  { 
    862     \$affectedRows = 0; // initialize var to track total num of affected rows   
     862    \$affectedRows = 0; // initialize var to track total num of affected rows 
    863863    if (!\$this->alreadyInSave) { 
    864864      \$this->alreadyInSave = true; 
    865865"; 
    866    
     866 
    867867    if (count($table->getForeignKeys())) { 
    868        
     868 
    869869      $script .= " 
    870870 
     
    874874      // foreign key reference. 
    875875"; 
    876      
     876 
    877877      foreach($table->getForeignKeys() as $fk) 
    878878      { 
     
    888888      } // foreach foreign k 
    889889    } // if (count(foreign keys)) 
    890      
    891     $script .= "  
     890 
     891    $script .= " 
    892892 
    893893      // If this object has been modified, then save it to the database. 
    894894      if (\$this->isModified()"; 
    895      
     895 
    896896    /* 
    897897    FIXME: this doesn't work right now because the BasePeer::doInsert() method 
     
    902902    } 
    903903    */ 
    904      
     904 
    905905    $script .= ") { 
    906906        if (\$this->isNew()) { 
    907907          \$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 
    910910                     // BasePeer::doInsert() can insert multiple rows). 
    911911"; 
    912912    if ($table->getIdMethod() != IDMethod::NO_ID_METHOD) { 
    913    
     913 
    914914      if (count($pks = $table->getPrimaryKey())) { 
    915915        foreach ($pks as $pk) { 
     
    922922      } 
    923923    } // if (id method != "none") 
    924    
     924 
    925925    $script .= " 
    926926          \$this->setNew(false); 
     
    955955  } // doSave() 
    956956"; 
    957    
    958   } 
    959    
     957 
     958  } 
     959 
    960960  /** 
    961961   * Adds the $alreadyInSave attribute, which prevents attempting to re-save the same object. 
     
    973973"; 
    974974  } 
    975    
     975 
    976976  /** 
    977977   * Adds the save() method. 
     
    10001000      \$con = Propel::getConnection(".$this->getPeerClassname()."::DATABASE_NAME); 
    10011001    } 
    1002      
     1002 
    10031003    try { 
    10041004      \$con->begin(); 
     
    10121012  } 
    10131013"; 
    1014    
    1015   } 
    1016    
     1014 
     1015  } 
     1016 
    10171017  /** 
    10181018   * Adds the $alreadyInValidation attribute, which prevents attempting to re-validate the same object. 
     
    10301030"; 
    10311031  } 
    1032    
     1032 
    10331033  /** 
    10341034   * Adds the validate() method. 
     
    10621062"; 
    10631063  } // addValidate() 
    1064    
     1064 
    10651065  /** 
    10661066   * Adds the workhourse doValidate() method. 
     
    10701070  { 
    10711071    $table = $this->getTable(); 
    1072      
     1072 
    10731073    $script .= " 
    10741074  /** 
     
    11091109      } /* for() */ 
    11101110    } /* if count(fkeys) */ 
    1111      
     1111 
    11121112    $script .= " 
    11131113 
     
    11331133      } /* if tableFK !+ table */ 
    11341134    } /* foreach getReferrers() */ 
    1135      
     1135 
    11361136    $script .= " 
    11371137 
     
    11431143"; 
    11441144  } // addDoValidate() 
    1145      
     1145 
    11461146  /** 
    11471147   * Adds the copy() method, which (in complex OM) includes the $deepCopy param for making copies of related objects. 
     
    11511151  { 
    11521152    $this->addCopyInto($script); 
    1153      
     1153 
    11541154    $table = $this->getTable(); 
    11551155 
     
    11591159   * It creates a new object filling in the simple attributes, but skipping any primary 
    11601160   * keys that are defined for the table. 
    1161    *  
     1161   * 
    11621162   * If desired, this method can also make copies of all associated (fkey referrers) 
    11631163   * objects. 
     
    11771177"; 
    11781178  } // addCopy() 
    1179    
     1179 
    11801180  /** 
    11811181   * Adds the copyInto() method, which takes an object and sets contents to match current object. 
     
    11901190  /** 
    11911191   * Sets contents of passed object to values from current object. 
    1192    *  
     1192   * 
    11931193   * If desired, this method can also make copies of all associated (fkey referrers) 
    11941194   * objects. 
     
    12381238        } 
    12391239"; 
    1240        
    1241         $script .= " 
     1240       
     1241       $script .= " 
    12421242        \$copyObj->add".$this->getRefFKPhpNameAffix($fk)."(\$relObj->copy(\$deepCopy)); 
    12431243      } 
     
    12501250"; 
    12511251    } /* if (count referrers > 0 ) */ 
    1252        
     1252 
    12531253    $script .= " 
    12541254 
     
    12701270"; 
    12711271  } // addCopyInto() 
    1272    
     1272 
    12731273} // PHP5ComplexObjectBuilder 
  • trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/NameFactory.php

    r497 r1410  
    22 
    33/* 
    4  *  $Id: NameFactory.php 289 2005-11-27 19:13:01Z hans $ 
     4 *  $Id: NameFactory.php 366 2006-05-23 13:00:30Z hans $ 
    55 * 
    66 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     
    2929 * @author Hans Lellelid <hans@xmpl.org> (Propel) 
    3030 * @author Daniel Rall <dlr@finemaltcoding.com> (Torque) 
    31  * @version $Revision: 289
     31 * @version $Revision: 366
    3232 * @package propel.engine.database.model 
    3333 */ 
     
    6363    } 
    6464 
    65     private function instance() 
     65    private static function instance() 
    6666    { 
    6767        if (self::$instance === null) { 
     
    7979    protected function getAlgorithm($name) 
    8080    { 
    81         // synchronized (algorithms) 
    82         $algorithm = @$this->algorithms[$name]; 
     81        $algorithm = isset($this->algorithms[$name]) ? $this->algorithms[$name] : null; 
    8382        if ($algorithm === null) { 
    8483            try { 
     
    110109     * @throws EngineException 
    111110     */ 
    112     public function generateName($algorithmName, $inputs) 
     111    public static function generateName($algorithmName, $inputs) 
    113112    { 
    114113        $algorithm = self::instance()->getAlgorithm($algorithmName); 
  • trunk/lib/vendor/propel-generator/resources/xsd/database.xsd

    r1310 r1410  
    1515 
    1616  <xs:element name="database" type="database"/> 
     17  <xs:element name="vendor" type="vendor"/> 
    1718 
    1819  <xs:simpleType name="file"> 
     
    218219 
    219220  <xs:complexType name="index"> 
    220     <xs:sequence
     221    <xs:choice maxOccurs="unbounded"
    221222      <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> 
    223225    <xs:attribute name="name" type="index_name" use="optional"/> 
    224226  </xs:complexType> 
    225227 
    226228  <xs:complexType name="unique"> 
    227     <xs:sequence
     229    <xs:choice maxOccurs="unbounded"
    228230      <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> 
    230233    <xs:attribute name="name" type="index_name" use="optional"/> 
    231234  </xs:complexType> 
     
    233236  <xs:complexType name="index-column"> 
    234237    <xs:sequence> 
    235       <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/> 
     238      <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 
    236239    </xs:sequence> 
    237240    <xs:attribute name="name" type="column_name" use="required"/> 
     
    241244  <xs:complexType name="unique-column"> 
    242245    <xs:sequence> 
    243       <xs:element name="vendor" type="vendor" minOccurs="0" maxOccurs="unbounded"/> 
     246      <xs:element ref="vendor" minOccurs="0" maxOccurs="unbounded"/> 
    244247    </xs:sequence> 
    245248    <xs:attribute name="name" type="column_name" use="required"/> 
     
    260263 
    261264  <xs:complexType name="column"> 
    262     <xs:sequence
     265    <xs:choice maxOccurs="unbounded"
    263266      <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> 
    266269    <xs:attribute name="name" type="column_name" use="required"/> 
    267270    <xs:attribute name="phpName" type="php_name" use="optional"/> 
     
    286289 
    287290  <xs:complexType name="foreign-key"> 
    288     <xs:sequence
     291    <xs:choice maxOccurs="unbounded"
    289292      <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> 
    292295    <xs:attribute name="foreignTable" type="table_name" use="required"/> 
    293296    <xs:attribute name="name" type="foreign_name" use="optional"/> 
     
    301304 
    302305  <xs:complexType name="table"> 
    303     <xs:sequence
     306    <xs:choice maxOccurs="unbounded"
    304307      <xs:element name="column" type="column" maxOccurs="unbounded"/> 
    305308      <xs:element name="foreign-key" type="foreign-key" minOccurs="0" maxOccurs="unbounded"/> 
     
    308311      <xs:element name="id-method-parameter" type="id-method-parameter" minOccurs="0" maxOccurs="unbounded"/> 
    309312      <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> 
    312315    <xs:attribute name="name" type="table_name" use="required"/> 
    313316    <xs:attribute name="phpName" type="php_class" use="optional"/> 
     
    328331 
    329332  <xs:complexType name="database"> 
    330     <xs:sequence
     333    <xs:choice maxOccurs="unbounded"
    331334      <xs:element name="external-schema" type="external-schema" minOccurs="0" maxOccurs="unbounded"/> 
    332335      <xs:element name="table" type="table" minOccurs="1" maxOccurs="unbounded"/> 
    333     </xs:sequence> 
     336    </xs:choice> 
    334337    <xs:attribute name="name" type="xs:string" use="optional"/> 
    335338    <xs:attribute name="defaultIdMethod" type="dbidmethod" default="none"/>