[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/propel-generator/templates/om/php4/ -> Peer.tpl (source)

   1  <?php
   2  
   3  // This is a [rather messy] template that builds a Peer class.
   4  //
   5  // These templates use the classes in propel.engine.database.model which represent the model (database).
   6  // These templates also use the propel.engine.builder classes (increasingly) to encapsulate some of the
   7  // repeating logic.
   8  //
   9  // These are based on velocity templates in original Torque.
  10  //
  11  // TODO:
  12  //      - move these into classes, perhaps, to further componentize the building of templates.
  13  //      - if these were classes it would also be easy to customize them through extension
  14  //
  15  // $Id: Peer.tpl,v 1.24 2005/03/29 16:35:52 micha Exp $
  16  
  17  include_once 'propel/engine/builder/om/PeerBuilder.php';
  18  include_once 'propel/engine/builder/om/ClassTools.php';
  19  include_once 'creole/CreoleTypes.php';
  20  
  21  $db = $table->getDatabase();
  22  if($table->getPackage()) {
  23    $package = $table->getPackage();
  24  } else {
  25    $package = $targetPackage;
  26  }
  27  
  28  echo '<' . '?' . 'php';
  29  
  30  $CLASS = $table->getPhpName() . 'Peer';
  31  $basePeerClass = ClassTools::getBasePeer($table);
  32  $basePeerClassname = ClassTools::classname($basePeerClass);
  33  ?>
  34  
  35  require_once '<?php echo ClassTools::getFilePath($basePeerClass) ?>';
  36  
  37  // The object class -- needed for instanceof checks in this class.
  38  // actual class may be a subclass -- as returned by <?php echo $table->getPhpName() ?>Peer::getOMClass()
  39  include_once '<?php echo ClassTools::getFilePath($package, $table->getPhpName()) ?>';
  40  <?php 
  41  foreach ($table->getForeignKeys() as $fk) {
  42      
  43     $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
  44     $tblFKPackage = ($tblFK->getPackage() ? $tblFK->getPackage() : $package); 
  45     
  46     if (!$tblFK->isForReferenceOnly()) {
  47  ?>   
  48  include_once '<?php echo ClassTools::getFilePath($tblFKPackage, $tblFK->getPhpName()) ?>';
  49  include_once '<?php echo ClassTools::getFilePath($tblFKPackage, $tblFK->getPhpName() . 'Peer') ?>';
  50  <?php 
  51      } // if (!$tblFK->isForReferenceOnly()
  52  } // foreach
  53  ?>
  54  
  55  /**
  56   * Base static class for performing query and update operations on the '<?php echo $table->getName() ?>' table.
  57   *
  58   * <?php echo $table->getDescription() ?>
  59   *
  60  <?php if ($addTimeStamp) { ?>
  61   * This class was autogenerated by Propel on:
  62   *
  63   * [<?php echo $now ?>]
  64   *
  65  <?php } ?>
  66   * @package <?php echo $package ?>
  67   */
  68  class <?php echo $basePrefix . $table->getPhpName() ?>Peer 
  69  {
  70  <?php if (!$table->isAlias()) { ?>
  71  
  72    /** the default database name for this class */
  73    function DATABASE_NAME() { return "<?php echo $table->getDatabase()->getName() ?>"; }
  74  
  75    /** the table name for this class */
  76    function TABLE_NAME() { return "<?php echo $table->getName() ?>"; }
  77  
  78  <?php foreach ($table->getColumns() as $col) { ?>
  79    /** the column name for the <?php echo strtoupper($col->getName()) ?> field */
  80    function <?php echo PeerBuilder::getColumnName($col) ?>() { return "<?php echo $table->getName() . '.' . strtoupper($col->getName()) ?>"; }
  81  <?php } ?>
  82  <?php } /* if (!$table->isAlias()) */ ?>
  83  
  84    /** number of columns for this peer (static) */
  85    function numColumns() { return <?php echo $table->getNumColumns() ?>; }
  86  
  87    /** number of lazy load columns for this peer */
  88    function numLazyLoadColumns() { return <?php echo $table->getNumLazyLoadColumns() ?>; }
  89    
  90    /** A class that can be returned by this peer. */
  91    function CLASS_DEFAULT() { return "<?php echo $package . '.' . $table->getPhpName() ?>"; }
  92  
  93    /** The PHP to DB Name Mapping (static) */
  94    var $phpNameMap = null;
  95  
  96    /**
  97    * @access private static
  98    */
  99    function & getInstance()
 100    {
 101      static $instance;
 102  
 103      if ($instance === null) {
 104        $instance = new <?php echo $table->getPhpName()?>Peer();
 105      }
 106  
 107      return $instance;
 108    }
 109  
 110    /**
 111     * @return MapBuilder the map builder for this peer
 112     * @access public static
 113     * @throws PropelException Any exceptions caught during processing will be
 114     *         rethrown wrapped into a PropelException.
 115     */
 116    function & getMapBuilder()
 117    {
 118      include_once '<?php echo ClassTools::getFilePath($pkmap, $table->getPhpName() . 'MapBuilder') ?>';
 119      return <?php echo $basePeerClassname ?>::getMapBuilder(<?php echo $table->getPhpName() ?>MapBuilder::CLASS_NAME());
 120    }
 121  
 122    /**
 123     * Gets a map (hash) of PHP names to DB column names.
 124     *
 125     * @return array The PHP to DB name map for this peer
 126     * @access public static
 127     * @throws PropelException Any exceptions caught during processing will be
 128     *         rethrown wrapped into a PropelException.
 129     * @todo Consider having template build the array rather than doing it at runtime.
 130     */
 131    function getPhpNameMap()
 132    {
 133      $self =& <?php echo $table->getPhpName()?>Peer::getInstance();
 134  
 135      if ($self->phpNameMap === null) {
 136        $map = $self->getTableMap();
 137        $columns = $map->getColumns();
 138        $nameMap = array();
 139        foreach ($columns as $column) {
 140          $nameMap[$column->getPhpName()] = $column->getColumnName();
 141        }
 142        $self->phpNameMap = $nameMap;
 143      }
 144      return $self->phpNameMap;
 145    }
 146  <?php
 147  
 148  if (!$table->isAlias()) {
 149  
 150  
 151    if ($table->getChildrenColumn()) {
 152  
 153      $col = $table->getChildrenColumn();
 154      $tfc = $table->getPhpName();
 155      $cfc = $col->getPhpName();
 156  
 157      if ($col->isEnumeratedClasses()) {
 158  
 159        if ($col->isPrimitiveNumeric()) $quote = "";
 160        else $quote = '"';
 161  
 162        foreach ($col->getChildren() as $child) {
 163          $childpkg = ($child->getPackage() ? $child->getPackage() : $package);
 164  ?>
 165    /** A key representing a particular subclass */
 166    function CLASSKEY_<?php echo strtoupper($child->getKey()) ?>() { return <?php echo $quote . $child->getKey() . $quote ?>; }
 167  
 168    /** A class that can be returned by this peer. */
 169    function CLASSNAME_<?php echo strtoupper($child->getKey()) ?>() { return "<?php echo $childpkg . '.' . $child->getClassName() ?>"; }
 170  <?php
 171        } /* foreach children */
 172      } /* if col->isenumerated...() */
 173    } /* if table->getchildrencolumn() */
 174  ?>
 175    /**
 176     * Convenience method which changes table.column to alias.column.
 177     *
 178     * Using this method you can maintain SQL abstraction while using column aliases.
 179     * <code>
 180     *    $c->addAlias("alias1", TablePeer::TABLE_NAME);
 181     *    $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 182     * </code>
 183     * @param string $alias The alias for the current table.
 184     * @param string $column The column name for current table. (i.e. <?php echo $table->getPhpName() ?>Peer::COLUMN_NAME).
 185     * @return string
 186     * @access public static
 187     */
 188    function alias($alias, $column)
 189    {
 190      return $alias . substr($column, strlen(<?php echo $table->getPhpName()?>Peer::TABLE_NAME()));
 191    }
 192  
 193    /**
 194    * Add all the columns needed to create a new object.
 195    *
 196    * Note: any columns that were marked with lazyLoad="true" in the
 197    * XML schema will not be added to the select list and only loaded
 198    * on demand.
 199    *
 200    * @param criteria object containing the columns to add.
 201    * @throws PropelException Any exceptions caught during processing will be
 202    *         rethrown wrapped into a PropelException.
 203    * @access public static
 204    */
 205    function addSelectColumns(/*Criteria*/ &$criteria)
 206    {
 207      Propel::typeHint($criteria, 'Criteria', '<?php echo $CLASS; ?>', 'addSelectColumns', 1);
 208  
 209  <?php
 210      foreach ($table->getColumns() as $col) { 
 211        if (! $col->isLazyLoad()) {
 212  ?>
 213      $criteria->addSelectColumn(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>());
 214  <?php 
 215        } 
 216      }
 217  ?>
 218    }
 219  
 220  <?php
 221    $countColumn = "*";
 222    if ($table->hasPrimaryKey()) {
 223      $pk = $table->getPrimaryKey();
 224      $countColumn = $table->getName() . "." . strtoupper($pk[0]->getName());
 225    }
 226  ?>
 227  
 228    function COUNT() { return "COUNT(<?php echo $countColumn?>)"; }
 229    function COUNT_DISTINCT() { return "COUNT(DISTINCT <?php echo $countColumn?>)"; }
 230  
 231    /**
 232    * Returns the number of rows matching criteria.
 233    *
 234    * @param Criteria $criteria a <code>Criteria</code> object.
 235    * @param boolean $distinct Whether to select only distinct columns.
 236    * @param Connection $con An optional Connection object.
 237    *
 238    * @return int Number of matching rows.
 239    */
 240    function doCount(/*Criteria*/ $criteria, $distinct = false, $con = null)
 241    {
 242      /* [MA] temporarily check */
 243      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doCount', 3);
 244      Propel::typeHint($criteria, 'Criteria', '<?php echo $CLASS; ?>', 'doCount', 1);
 245  
 246      /*
 247      * clear out anything that might confuse the ORDER BY clause. 
 248      * Note: unlike php5 version $criteria is passed by value and has not to be cloned.
 249      */
 250      $criteria->clearSelectColumns();
 251      $criteria->clearOrderByColumns();
 252      
 253      if ($distinct || in_array(Criteria::DISTINCT(), $criteria->getSelectModifiers())) {
 254        $criteria->addSelectColumn(<?php echo $table->getPhpName()?>Peer::COUNT_DISTINCT());
 255      } else {
 256        $criteria->addSelectColumn(<?php echo $table->getPhpName()?>Peer::COUNT());
 257      }
 258      // just in case we're grouping: add those columns to the select statement
 259      foreach($criteria->getGroupByColumns() as $column)
 260      {
 261        $criteria->addSelectColumn($column);
 262      }
 263  
 264      $rs =& <?php echo $table->getPhpName()?>Peer::doSelectRS($criteria, $con);
 265      if (Propel::isError($rs)) { return $rs; }
 266  
 267      if ($rs->next() === true) {
 268        return $rs->getInt(1);
 269      }
 270  
 271      /* no rows returned; we infer that means 0 matches */
 272      return 0;
 273    }
 274  
 275    /**
 276    * Method to select one object from the DB.
 277    * 
 278    * @param Criteria $criteria Object used to create the SELECT statement.
 279    * @param Connection $con An optional Connection object.
 280    *
 281    * @return mixed <?php echo $table->getPhpName() ?> on success, NULL on failure.
 282    */
 283    function & doSelectOne($criteria, $con = null)
 284    {
 285      /* [MA] temporarily check */
 286      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelectOne', 2);
 287  
 288      $criteria->setLimit(1);
 289  
 290      $objects =& <?php echo $table->getPhpName()?>Peer::doSelect($criteria, $con);
 291      if (Propel::isError($objects)) { return $objects; }
 292  
 293      if ($objects) {
 294        return $objects[0];
 295      }
 296  
 297      return null;
 298    }
 299  
 300    /**
 301    * Method to do selects.
 302    *
 303    * @param Criteria $criteria Object used to create the SELECT statement.
 304    * @param Connection $con An optional Connection object.
 305    *
 306    * @return array Array of selected Objects
 307    * @throws PropelException Any exceptions caught during processing will be
 308    *         rethrown wrapped into a PropelException.
 309    */
 310    function & doSelect($criteria, $con = null)
 311    {
 312      /* [MA] temporarily check */
 313      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelect', 2);
 314  
 315      $rs =& <?php echo $table->getPhpName()?>Peer::doSelectRS($criteria, $con);
 316      if (Propel::isError($rs)) { return $rs; }
 317  
 318      return <?php echo $table->getPhpName()?>Peer::populateObjects($rs);
 319    }
 320  
 321    /**
 322    * Prepares the Criteria object and uses the parent doSelect()
 323    * method to get a ResultSet.
 324    *
 325    * Use this method directly if you want to just get the resultset
 326    * (instead of an array of objects).
 327    *
 328    * @param Criteria $criteria
 329    * @param Connection $con An optional Connection object.
 330    *
 331    * @return ResultSet The resultset object with numerically-indexed fields.
 332    *         PropelException Any exceptions caught during processing will be
 333    *         rethrown wrapped into a PropelException.
 334    * @see <?php echo $basePeerClassname ?>::doSelect()
 335    */
 336    function & doSelectRS($criteria, $con = null)
 337    {
 338      /* [MA] temporarily check */
 339      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelectRS', 2);
 340  
 341      /* [MA] do not retrieve connection here, BasePeer::doSelect will do */
 342      
 343      if (!$criteria->getSelectColumns()) {
 344        <?php echo $table->getPhpName()?>Peer::addSelectColumns($criteria);
 345      }
 346  
 347      // Set the correct dbName
 348      $criteria->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());    
 349  
 350      // BasePeer returns a Creole ResultSet, set to return
 351      // rows indexed numerically.
 352      return <?php echo $basePeerClassname ?>::doSelect($criteria, $con);
 353    }
 354  
 355    /**
 356    * The returned array will contain objects of the default type or
 357    * objects that inherit from the default.
 358    *
 359    * @return Array of <?php echo $table->getPhpName()?> objects on success OR
 360    *         PropelException Any exceptions caught during processing will be
 361    *         returned wrapped into a PropelException.
 362    */
 363    function & populateObjects(/*ResultSet*/ &$rs)
 364    {
 365      $results = array();
 366  
 367      if (! is_a($rs, 'ResultSet')) {
 368        return new PropelException(PROPEL_ERROR, "parameter not of type 'ResultSet'");
 369      }
 370  
 371  <?php if (!$table->getChildrenColumn()) { ?>
 372      // set the class once to avoid overhead in the loop
 373      $cls = <?php echo $table->getPhpName() ?>Peer::getOMClass();
 374  
 375      if (Propel::isError($cls =& Propel::import($cls))) {
 376        return $cls;
 377      }
 378  <?php } ?>
 379  
 380      // populate the object(s)
 381      while($rs->next())
 382      {
 383  <?php if ($table->getChildrenColumn()) { ?>
 384        // class must be set each time from the record row
 385        $cls =& Propel::import(<?php echo $table->getPhpName() ?>Peer::getOMClass($rs, 1));
 386        if (Propel::isError($cls)) {
 387          return $cls;
 388        }
 389        $obj =& new $cls();
 390  
 391        if (Propel::isError($e =& $obj->hydrate($rs))) {
 392          return $e;
 393        }
 394  
 395        $results[] =& $obj;
 396  <?php } else { ?>
 397        $obj =& new $cls();
 398  
 399        if (Propel::isError($e =& $obj->hydrate($rs))) {
 400          return $e;
 401        }
 402  
 403        $results[] =& $obj;
 404  <?php } ?>
 405      }
 406  
 407      return $results;
 408    }
 409  
 410  <?php  } /* if !table->isAlias() */ ?>
 411  
 412  <?php if ($table->getChildrenColumn()) {
 413  
 414    $col = $table->getChildrenColumn();
 415  ?>
 416  
 417    /**
 418    * The returned Class will contain objects of the default type or
 419    * objects that inherit from the default.
 420    *
 421    * @param ResultSet $rs ResultSet with pointer to record containing om class.
 422    * @param int $colnum Column to examine for OM class information (first is 1).
 423    *
 424    * @throws PropelException Any exceptions caught during processing will be
 425    *         rethrown wrapped into a PropelException.
 426    */
 427    function getOMClass(/*ResultSet*/ &$rs, $colnum)
 428    {
 429      $c = null;
 430  
 431  <?php if ($col->isEnumeratedClasses()) { ?>
 432  
 433      $omClass = null;
 434      $classKey = $rs->getString($colnum - 1 + <?php echo $col->getPosition() ?>);
 435  
 436      switch($classKey)
 437      {
 438  <?php
 439        foreach ($col->getChildren() as $child) {
 440  ?>
 441        case <?php echo $table->getPhpName()?>Peer::CLASSKEY_<?php echo strtoupper($child->getKey()) ?>():
 442          $omClass = <?php echo $table->getPhpName()?>Peer::CLASSNAME_<?php echo strtoupper($child->getKey()) ?>();
 443          break;
 444  <?php } /* foreach */ ?>
 445        default:
 446  <?php if ($table->isAbstract()) { ?>
 447          $error = "You must implement the getOMClass method in your"
 448              ." Peer object in order for things to work properly."
 449              ." This method should return the proper Class that"
 450              ." represents the Peer's Business Object.";
 451  
 452          return new PropelException(PROPEL_ERROR, $error);
 453  <?php } else { ?>
 454  
 455      $omClass = <?php echo $table->getPhpName()?>Peer::CLASS_DEFAULT();
 456  
 457  <?php } ?>
 458  
 459      } // switch
 460  
 461      $c = $omClass;
 462  
 463  <?php } else { /* if not enumerated */ ?>
 464  
 465      $c =& Propel::import($rs->getString($colnum - 1 + <?php echo $col->getPosition() ?>));
 466  
 467      if (Propel::isError($c)) {
 468        return $c;
 469      }
 470    <?php } ?>
 471  
 472      return $c;
 473    }
 474  
 475  <?php } else { /* if table->getchildrencolumn */ ?>
 476  
 477    /**
 478     * The class that the Peer will make instances of.
 479     * If the BO is abstract then you must implement this method
 480     * in the BO.
 481     *
 482     * @throws PropelException Any exceptions caught during processing will be
 483     *         rethrown wrapped into a PropelException.
 484     */
 485    function getOMClass()
 486    {
 487  <?php if ($table->isAbstract()) { ?>
 488      $error = "You must implement the getOMClass method in your"
 489          ." Peer object in order for things to work properly."
 490          ." This method should return the proper Class that"
 491          ." represents the Peer's Business Object.";
 492  
 493      return new PropelException(PROPEL_ERROR, $error);
 494  <?php } else { ?>
 495      return <?php echo $table->getPhpName()?>Peer::CLASS_DEFAULT();
 496  <?php } ?>
 497    }
 498  <?php }  /* if table->getchildrencolumn */
 499  
 500  if (!$table->isAlias() && ! $table->isReadOnly()) 
 501  { 
 502  ?>
 503    /**
 504    * Method to do inserts.  This method is to be used during a transaction,
 505    * otherwise use the doInsert(Criteria) method.  It will take care of
 506    * the connection details internally.
 507    *
 508    * @param mixed $values Criteria or <?php echo $table->getPhpName() ?> object containing data
 509    *                      that is used to create the INSERT statement.
 510    * @param Connection $con The connection to use
 511    *
 512    * @return mixed The new primary key.
 513    * @throws PropelException Any exceptions caught during processing will be
 514    *         rethrown wrapped into a PropelException.
 515    */
 516    function doInsert(&$values, $con = null)
 517    {
 518      /* [MA] temporarily check */
 519      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doInsert', 2);
 520  
 521      $con =& Param::get($con);
 522  
 523      if ($con === null) {
 524        $con =& Propel::getConnection(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 525        if (Propel::isError($con)) { return $con; }
 526      }
 527  
 528      if (is_a($values, 'Criteria')) {
 529          $criteria =& $values;
 530      } else {
 531          $criteria =& $values->buildCriteria();
 532      }
 533  
 534  <?php 
 535    foreach ($table->getColumns() as $col) 
 536    {
 537      $cfc = $col->getPhpName();
 538      if ($col->isPrimaryKey() && $col->isAutoIncrement() && $table->getIdMethod() != "none") 
 539      { 
 540  ?>
 541      $criteria->remove(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>()); // remove pkey col since this table uses auto-increment
 542  <?php
 543      }
 544    }
 545  ?> 
 546      // Set the correct dbName
 547      $criteria->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 548  
 549      // use transaction because $criteria could contain info
 550      // for more than one table (I guess, conceivably)
 551      $e = $con->begin();
 552      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 553  
 554      $pk = <?php echo $basePeerClassname ?>::doInsert($criteria, $con);
 555      if (Propel::isError($pk)) { $con->rollback(); return $pk; }
 556  
 557      $e = $con->commit();
 558      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 559  
 560      return $pk;
 561    }
 562  
 563  <?php
 564    // Both UPDATE and DELETE can use cascade emulation if the DB driver
 565    // doesn't natively support ON UPDATE CASCADE / ON DELETE CASCADE
 566    //
 567    // Support for ON UPDATE CASCADE emulation has been removed because
 568    // it doesn't make any sense for Propel.  ON UPDATE CASCADE works by
 569    // updating referring rows when the pkey is updated; pkeys can never be
 570    // updated unless using the BasePeer class directly.  This behavior may
 571    // change, but for now updateCascade has been removed.
 572  
 573    // Check to see whether this table has any foreign keys that should be
 574    // cascaded and set the $deleteCascadeRelevant
 575  
 576    $deleteCascadeRelevant = false;
 577    $deleteSetNullRelevant = false;
 578  
 579    if (! $platform->supportsNativeDeleteTrigger() && count($table->getReferrers()) > 0) {
 580      foreach ($table->getReferrers() as $fk) {
 581        if ( $fk->getOnDelete() == ForeignKey::CASCADE ) {
 582          $deleteCascadeRelevant = true;
 583        } 
 584        elseif ($fk->getOnDelete() == ForeignKey::SETNULL) {
 585          $deleteSetNullRelevant = true;
 586        }
 587      }
 588    } // if count(foreign keys)
 589  ?>
 590    /**
 591    * Method perform an UPDATE on the database, given a <?php echo $table->getPhpName() ?> or Criteria object.
 592    *
 593    * @param mixed $values Criteria or <?php echo $table->getPhpName() ?> object containing data that is used to create the UPDATE statement.
 594    * @param Connection $con The connection to use.
 595    *
 596    * @return mixed number of affected rows on success, any exceptions returned during processing
 597    *         wrapped in a PropelException on failure.
 598    */
 599    function doUpdate(&$values, $con = null)
 600    {
 601      /* [MA] temporarily check */
 602      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doUpdate', 2);
 603  
 604      $con =& Param::get($con);
 605  
 606      if ($con === null) {
 607        $con =& Propel::getConnection(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 608        if (Propel::isError($con)) { return $con; }
 609      }
 610  
 611      $selectCriteria =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 612  
 613      if (is_a($values, 'Criteria')) {
 614        $criteria =& $values;
 615  <?php 
 616    foreach ($table->getColumns() as $col) 
 617    {
 618      if($col->isPrimaryKey()) 
 619      { 
 620        $pn = $table->getPhpName() . 'Peer';
 621        $cn = PeerBuilder::getColumnName($col);
 622  ?>
 623        $comparison = $criteria->getComparison(<?php echo $pn?>::<?php echo $cn?>());
 624        $selectCriteria->add(<?php echo $pn?>::<?php echo $cn ?>(), $criteria->remove(<?php echo $pn ?>::<?php echo $cn ?>()), $comparison);
 625  <?php 
 626      }  /* if col is prim key */
 627    } /* foreach */
 628  ?>
 629      } else { // $values is <?php echo $table->getPhpName() ?> object
 630          $criteria = $values->buildCriteria(); // gets full criteria
 631          $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)            
 632      }    
 633  
 634      // Set the correct dbName
 635      $criteria->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());    
 636  
 637      return <?php echo $basePeerClassname ?>::doUpdate($selectCriteria, $criteria, $con);
 638    }
 639  
 640    /**
 641    * Method to DELETE all rows from the <?php echo $table->getName() ?> table.
 642    *
 643    * <b>Note</b>: If you want to pass a Connection object as reference,
 644    * use Param::set() :
 645    *
 646    * <code>
 647    *  $con =& Propel::getConnection();
 648    *  $e = BasePeer::doDeleteAll(Param::set($con));
 649    * </code>
 650    *
 651    * @return mixed number of affected rows on success, PropelException on failure.
 652    */
 653    function doDeleteAll($con = null)
 654    {
 655      /* [MA] temporarily check */
 656      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doDeleteAll', 2);
 657  
 658      $con =& Param::get($con);
 659  
 660      if ($con === null) {
 661        $con =& Propel::getConnection(<?php echo $table->getPhpName() ?>Peer::DATABASE_NAME());
 662        if (Propel::isError($con)) { return $con; }
 663      }
 664  
 665      $affectedRows = 0; // initialize var to track total num of affected rows    
 666      
 667      // use transaction because $criteria could contain info
 668      // for more than one table or we could emulating ON DELETE CASCADE, etc.
 669      $e = $con->begin();
 670      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 671  <?php if ($deleteCascadeRelevant) { ?>
 672  
 673      $e = <?php echo $table->getPhpName() ?>Peer::doOnDeleteCascade(new Criteria(), $con);
 674      if (Propel::isError($e)) { $con->rollback(); return $e; }
 675      $affectedRows += $e;
 676  <?php } elseif ($deleteSetNullRelevant) { ?>
 677  
 678      $e = <?php echo $table->getPhpName() ?>Peer::doOnDeleteSetNull(new Criteria(), $con);
 679      if (Propel::isError($e)) { $con->rollback(); return $e; }
 680      $affectedRows += $e;
 681  <?php } ?>
 682  
 683      $e = BasePeer::doDeleteAll(<?php echo $table->getPhpName() ?>Peer::TABLE_NAME(), $con);
 684      if (Propel::isError($e)) { $con->rollback(); return $e; }
 685      $affectedRows += $e;
 686  
 687      $e = $con->commit();
 688      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 689  
 690      return $affectedRows;
 691    }
 692  
 693    /**
 694    * Method perform a DELETE on the database, given a <?php echo $table->getPhpName() ?> or Criteria object OR a primary key value.
 695    *
 696    * @param mixed $values Criteria or <?php echo $table->getPhpName() ?> object containing data that is used to create the DELETE statement.
 697    * @param Connection $con the connection to use
 698    *
 699    * @return mixed number of affected rows on success, any exception returned during processing wrapped into a PropelException on failure.
 700    */
 701    function doDelete(&$values, $con = null)
 702    {
 703      /* [MA] temporarily check */
 704      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doDelete', 2);
 705  
 706      $con =& Param::get($con);
 707  
 708      if ($con === null) {
 709        $con =& Propel::getConnection(<?php echo $table->getPhpName() ?>Peer::DATABASE_NAME());
 710        if (Propel::isError($con)) { return $con; }
 711      }
 712  
 713      if (is_a($values, 'Criteria')) {
 714        $criteria =& $values;
 715      } 
 716      elseif (is_a($values, '<?php echo $table->getPhpName() ?>')) {
 717  <?php
 718    $pkey_count = 0;
 719    foreach ($table->getColumns() as $col) {
 720      if($col->isPrimaryKey()) {
 721        $pkey_count++;
 722      }
 723    }
 724  
 725    if ($pkey_count > 0) { 
 726  ?>
 727        $criteria =& $values->buildPkeyCriteria();
 728  <?php  } else { ?>
 729        $criteria =& $values->buildCriteria();
 730  <?php  } ?>
 731      } 
 732      else {
 733        // it must be the primary key
 734        $criteria =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 735  <?php
 736    if (count($table->getPrimaryKey()) == 1) { 
 737      $col = array_shift($table->getPrimaryKey()); 
 738  ?>
 739        $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $values);
 740  <?php  
 741    } else { 
 742  ?>
 743        // primary key is composite; we therefore, expect
 744        // the primary key passed to be an array of pkey
 745        // values
 746  <?php
 747      $i=0;
 748      foreach($table->getPrimaryKey() as $col) { 
 749  ?>
 750        $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col)?>(), $values[<?php echo $i ?>]);
 751  <?php 
 752        $i++; 
 753      }
 754    } /* if count(table.PrimaryKeys) */ 
 755  ?>
 756      }
 757  
 758      // Set the correct dbName    
 759      $criteria->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 760      
 761      $affectedRows = 0; // initialize var to track total num of affected rows    
 762  
 763      // use transaction because $criteria could contain info
 764      // for more than one table or we could emulating ON DELETE CASCADE, etc.
 765      $e = $con->begin();
 766      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 767  
 768  <?php
 769    if ($deleteCascadeRelevant) { 
 770  ?>
 771      $e = <?php echo $table->getPhpName()?>Peer::doOnDeleteCascade($criteria, $con);
 772      if (Propel::isError($e)) { $con->rollback(); return $e; }
 773      $affectedRows += $e;
 774  <?php
 775    } elseif ($deleteSetNullRelevant) { 
 776  ?>
 777      $e = <?php echo $table->getPhpName()?>Peer::doOnDeleteSetNull($criteria, $con);
 778      if (Propel::isError($e)) { $con->rollback(); return $e; }
 779      $affectedRows += $e;
 780  
 781  <?php
 782    } 
 783  ?>
 784      $e = <?php echo $basePeerClassname ?>::doDelete($criteria, $con);
 785      if (Propel::isError($e)) { $con->rollback(); return $e; }
 786      $affectedRows += $e;
 787  
 788      $e = $con->commit();
 789      if (Creole::isError($e)) { $con->rollback(); return new PropelException(PROPEL_ERROR_DB, $e); }
 790  
 791      return $affectedRows;
 792    }
 793  
 794  <?php
 795    if ($deleteCascadeRelevant) 
 796    { 
 797  ?>
 798    /**
 799    * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
 800    * feature (like MySQL or SQLite).
 801    *
 802    * This method is not very speedy because it must perform a query first to get
 803    * the implicated records and then perform the deletes by calling those Peer classes.
 804    *
 805    * This method should be used within a transaction if possible.
 806    *
 807    * @param Criteria $criteria
 808    * @param Connection $con
 809    *
 810    * @return number of affected rows on success, PropelException on failure.
 811    */
 812    function doOnDeleteCascade(/*Criteria*/ $criteria, /*Connection*/ &$con)
 813    {
 814      // initialize var to track total num of affected rows
 815      $affectedRows = 0;
 816  
 817      // first find the objects that are implicated by the $criteria
 818      $objects =& <?php echo $table->getPhpName()?>Peer::doSelect($criteria, Param::set($con));
 819      if (Propel::isError($objects)) { return $objects; }
 820  
 821      for($i=0, $j=count($objects); $i < $j; $i++)
 822      {
 823        $obj =& $objects[$i];
 824  <?php
 825      foreach ($table->getReferrers() as $fk) 
 826      {
 827        // $fk is the foreign key in the other table, so localTableName will
 828        // actually be the table name of other table
 829        $tblFK = $fk->getTable();
 830        $tblFKPackage = ($tblFK->getPackage() ? $tblFK->getPackage() : $package);
 831  
 832        if (!$tblFK->isForReferenceOnly()) 
 833        {
 834          // we can't perform operations on tables that are
 835          // not within the schema (i.e. that we have no map for, etc.)
 836          $fkClassName = $tblFK->getPhpName();
 837  
 838          // i'm not sure whether we can allow delete cascade for foreign keys
 839          // within the same table?  perhaps we can?
 840          if ( $fk->getOnDelete() == ForeignKey::CASCADE && $fk->getTable()->getName() != $table->getName()) 
 841          {
 842            // backwards on purpose
 843            $columnNamesF = $fk->getLocalColumns();
 844            $columnNamesL = $fk->getForeignColumns(); // should be same num as foreign
 845  ?>
 846  
 847        include_once '<?php echo ClassTools::getFilePath($tblFKPackage, $tblFK->getPhpName()); ?>';
 848  
 849        // delete related <?php echo $fkClassName ?> objects
 850        $c =& new Criteria();
 851  <?php
 852            for($x=0,$xlen=count($columnNamesF); $x < $xlen; $x++) {
 853              $columnFK = $tblFK->getColumn($columnNamesF[$x]);
 854              $columnL = $table->getColumn($columnNamesL[$x]);
 855  ?>
 856        $c->add(<?php echo PeerBuilder::getColumnName($columnFK, $fkClassName) ?>(), $obj->get<?php echo $columnL->getPhpName() ?>());
 857  
 858  <?php
 859              //$delCmds[] = $fkClassName.'Peer::doDelete('.');
 860            }
 861  ?>
 862        $e = <?php echo $fkClassName ?>Peer::doDelete($c, Param::set($con));
 863        if (Propel::isError($e)) { return $e; }
 864        $affectedRows += $e;
 865  <?php
 866          } // if cascade && fkey table name != curr table name
 867  
 868        } // if not for ref only
 869      } // foreach foreign keys
 870  ?>
 871      }
 872  
 873      return $affectedRows;
 874    }
 875  
 876  <?php } elseif ($deleteSetNullRelevant) { ?>
 877  
 878    /**
 879    * This is a method for emulating ON DELETE SET NULL DBs that don't support this
 880    * feature (like MySQL or SQLite).
 881    *
 882    * This method is not very speedy because it must perform a query first to get
 883    * the implicated records and then perform the deletes by calling those Peer classes.
 884    *
 885    * This method should be used within a transaction if possible.
 886    *
 887    * @param Criteria $criteria
 888    * @param Connection $con
 889    *
 890    * @return mixed number of affected rows on success, PropelException on failure.
 891    */
 892    function doOnDeleteSetNull(/*Criteria*/ $criteria, /*Connection*/ &$con)
 893    {
 894      // initialize var to track total num of affected rows
 895      $affectedRows = 0;
 896  
 897      // first find the objects that are implicated by the $criteria
 898      $objects =& <?php echo $table->getPhpName()?>Peer::doSelect($criteria, Param::set($con));
 899      if (Propel::isError($objects)) { return $objects; }
 900  
 901      for($i=0, $j=count($objects); $i < $j; $i++)
 902      {
 903        $obj =& $objects[$i];
 904  <?php
 905  
 906          // This logic is almost exactly the same as that in doOnDeleteCascade()
 907          // it may make sense to refactor this, provided that thigns don't
 908          // get too complicated.
 909  
 910        foreach ($table->getReferrers() as $fk) {
 911  
 912          // $fk is the foreign key in the other table, so localTableName will
 913          // actually be the table name of other table
 914          $tblFK = $fk->getTable();
 915  
 916          if (!$tblFK->isForReferenceOnly()) {
 917            // we can't perform operations on tables that are
 918            // not within the schema (i.e. that we have no map for, etc.)
 919  
 920            $fkClassName = $tblFK->getPhpName();
 921  
 922            // i'm not sure whether we can allow delete setnull for foreign keys
 923            // within the same table?  perhaps we can?
 924            if ( $fk->getOnDelete() == ForeignKey::SETNULL &&
 925                $fk->getTable()->getName() != $table->getName()) {
 926  
 927              // backwards on purpose
 928              $columnNamesF = $fk->getLocalColumns();
 929              $columnNamesL = $fk->getForeignColumns(); // should be same num as foreign
 930  ?>
 931        // set fkey col in related <?php echo $fkClassName ?> rows to NULL
 932        $selectCriteria =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 933        $updateValues =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
 934  <?php
 935              for($x=0,$xlen=count($columnNamesF); $x < $xlen; $x++) {
 936                $columnFK = $tblFK->getColumn($columnNamesF[$x]);
 937                $columnL = $table->getColumn($columnNamesL[$x]);
 938  
 939  ?>
 940        $selectCriteria->add(<?php echo PeerBuilder::getColumnName($columnFK, $fkClassName) ?>(),
 941                             $obj->get<?php echo $columnL->getPhpName() ?>());
 942        $updateValues->add(<?php echo PeerBuilder::getColumnName($columnFK, $fkClassName) ?>(), null);
 943  <?php
 944     }
 945  ?>
 946        // use BasePeer because generated Peer doUpdate() methods only update using pkey
 947        $e = <?php echo $basePeerClassname ?>::doUpdate($selectCriteria, $updateValues, $con);
 948        if (Propel::isError($e)) { return $e; }
 949        $affectedRows += $e;
 950  <?php
 951            } // if cascade && fkey table name != curr table name
 952  
 953          } // if not for ref only
 954        } // foreach foreign keys
 955  ?>
 956      }
 957  
 958      return $affectedRows;
 959    }
 960  
 961  <?php } /* if setnull relevant */ ?>
 962  
 963  
 964    /**
 965    * Validates all modified columns of given <?php echo $table->getPhpName()?> object.
 966    * If parameter $columns is either a single column name or an array of column names
 967    * than only those columns are validated.
 968    *
 969    * NOTICE: This does not apply to primary or foreign keys for now.
 970    *
 971    * @param <?php echo $table->getPhpName()?> $obj The object to validate.
 972    * @param mixed $cols Column name or array of column names.
 973    *
 974    * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
 975    */
 976    function doValidate(&$obj, $cols = null)
 977    {
 978      Propel::typeHint($obj, '<?php echo $table->getPhpName()?>', '<?php echo $CLASS; ?>', 'doValidate');
 979  
 980      $dbName = <?php echo $table->getPhpName()?>Peer::DATABASE_NAME();
 981      $tableName = <?php echo $table->getPhpName()?>Peer::TABLE_NAME();
 982      $columns = array();
 983  
 984      if ($cols)
 985      {
 986        $dbMap =& Propel::getDatabaseMap($dbName);
 987        $tableMap =& $dbMap->getTable($tableName);
 988  
 989        if (! is_array($cols)) {
 990          $cols = array($cols);
 991        }
 992  
 993        foreach($cols as $colName)
 994        {
 995          if ($tableMap->containsColumn($colName))
 996          {
 997            $colMap =& $tableMap->getColumn($colName);
 998            $get = 'get' . $colMap->getPhpName();
 999            $columns[$colName] = $obj->$get();
1000          }
1001        }
1002      }
1003      else
1004      {
1005  <?php
1006    foreach ($table->getValidators() as $val) {
1007      $col = $val->getColumn();
1008      if (! $col->isAutoIncrement()) {
1009        $cfc = $col->getPhpName();
1010        $cup = strtoupper($col->getName());
1011  ?>
1012      if ($obj->isNew() || $obj->isColumnModified(<?php echo $table->getPhpName()?>Peer::<?php echo $cup?>()))
1013        $columns[<?php echo $table->getPhpName()?>Peer::<?php echo $cup?>()] = $obj->get<?php echo $cfc?>();
1014  <?php
1015      } // if
1016    } // foreach
1017  ?>
1018      }
1019  
1020      return <?php echo $basePeerClassname ?>::doValidate($dbName, $tableName, $columns);
1021    }
1022  
1023    /**
1024     * Build a Criteria object from the data object for this peer or from primary key(s).
1025     *
1026     * @param mixed $obj <?php echo $table->getPhpName() ?> object or <?php if (count($table->getPrimaryKey()) == 1) { ?>scalar primary key<?php } else { ?>array primary keys<?php } ?>.
1027     * @return Criteria The compiled Criteria object.
1028     */
1029    function buildCriteria(&$obj)
1030    {
1031      if (is_a($obj, '<?php echo $table->getPhpName() ?>' )) {
1032        $criteria =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1033  <?php
1034          foreach ($table->getColumns() as $col) {
1035            $cfc = $col->getPhpName();
1036            if ($col->isPrimaryKey() && $table->getIdMethod() != "none") {
1037  ?>
1038        if (! $obj->isNew())
1039          $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $obj->get<?php echo $cfc ?>()); // primary key on tables w/ id generation is only added if not new
1040  <?php   } else { /* if col is not prim key */ ?>
1041        if ($obj->isColumnModified(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>()))
1042          $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $obj->get<?php echo $cfc ?>());
1043  <?php
1044            }
1045          }
1046  ?>
1047  
1048      } else {
1049        // it must be the primary key
1050        $criteria =& new Criteria(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1051        <?php if (count($table->getPrimaryKey()) == 1) {
1052            $col = array_shift($table->getPrimaryKey()); ?>
1053  
1054        $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $obj);
1055        <?php } else { ?>
1056          // primary key is composite; we therefore, expect
1057        // the primary key passed to be an array of pkey
1058        // values
1059      <?php
1060          $i=0;
1061            foreach($table->getPrimaryKey() as $col) { ?>
1062        $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col)?>(), $obj[<?php echo $i ?>]);
1063      <?php     $i++;
1064          }
1065        } /* if count(table.PrimaryKeys) */ ?>
1066  
1067      }
1068  
1069      return $criteria;
1070    }
1071  <?php } /* if !table->isalias */ ?>
1072  
1073  <?php if (count($table->getPrimaryKey()) > 0) {
1074  
1075    if ($table->isAlias()) {
1076      $retrieveMethod = "retrieve" . $table->getPhpName() . "ByPK";
1077    } else {
1078      $retrieveMethod = "retrieveByPK";
1079    }
1080  
1081    $pks = $table->getPrimaryKey();
1082  
1083  if (count($table->getPrimaryKey()) === 1) {  ?>
1084  
1085    /**
1086    * Retrieve a single object by pkey or <em>NULL</em> if not found.
1087    *
1088    * @param mixed $pk The primary key.
1089    * @param Connection $con The connection to use.
1090    *
1091    * @return mixed <?php echo $table->getPhpName(); ?> on success, NULL on failure
1092    */
1093    function & <?php echo $retrieveMethod ?>($pk, $con = null)
1094    {
1095      /* [MA] temporarily check */
1096      Propel::assertParam($con, '<?php echo $CLASS; ?>', '<?php echo $retrieveMethod; ?>', 2);
1097  
1098      $criteria =& new Criteria();
1099  <?php if (count($table->getPrimaryKey()) === 1) { 
1100          $col = array_shift($table->getPrimaryKey());
1101  ?>
1102      $criteria->add(<?php echo $table->getPhpName() ?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $pk);
1103  <?php
1104        } else {
1105  ?>
1106      // primary key is composite; we therefore, expect
1107      // the primary key passed to be an array of pkey
1108      // values
1109  <?php
1110         $i=0;
1111         foreach($table->getPrimaryKey() as $col) {
1112  ?>
1113      $criteria->add(<?php echo $table->getPhpName() ?>Peer::<?php echo PeerBuilder::getColumnName($col)?>, $pk[<?php echo $i ?>]);
1114  <?php
1115            $i++; 
1116         }
1117       } /* if count(table.PrimaryKeys) */
1118  ?>
1119  
1120      $v = <?php echo $table->getPhpName() ?>Peer::doSelect($criteria, $con);
1121      return count($v) > 0 ? $v[0] : null;
1122    }
1123  
1124    /**
1125    * Retrieve multiple objects by pkey.
1126    *
1127    * @param array $pks List of primary keys
1128    * @param Connection $con The connection to use.
1129    *
1130    * @throws PropelException Any exceptions caught during processing will be
1131    *         rethrown wrapped into a PropelException.
1132    */
1133    function & <?php echo $retrieveMethod ?>s($pks, $con = null)
1134    {
1135      /* [MA] temporarily check */
1136      Propel::assertParam($con, '<?php echo $CLASS; ?>', '<?php echo $retrieveMethod; ?>', 2);
1137  
1138      $objs = null;
1139      if (empty($pks)) {
1140        $objs = array();
1141      } else {
1142        $criteria =& new Criteria();
1143  <?php if (count($table->getPrimaryKey()) == 1) { ?>
1144  
1145        $criteria->add(<?php echo $table->getPhpName() ?>Peer::<?php $k1 = $table->getPrimaryKey(); echo strtoupper($k1[0]->getName()); ?>(), $pks, Criteria::IN());
1146  <?php } else { ?>
1147  
1148        for($k=0,$size=count($pks); $k < $size; $k++) {
1149          $pk = $pks[$k];
1150          <?php $i = 0;
1151            foreach($table->getPrimaryKey() as $col) { ?>
1152  
1153          $c<?php echo $i ?> =& $criteria->getNewCriterion(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $pk[<?php echo $i ?>], Criteria::EQUAL());
1154          <?php
1155          $j = $i - 1;
1156          if ($i > 0) { ?>
1157  
1158          $c<?php echo $j ?>->addAnd($c<?php echo $i ?>);
1159            <?php } /* if $i > 0 */
1160              $i++;
1161            } /* foreach */ ?>
1162  
1163          $criteria->addOr($c0);
1164        }
1165    <?php } /* if count prim keys == 1 */ ?>
1166  
1167        $objs =& <?php echo $table->getPhpName()?>Peer::doSelect($criteria, $con);
1168        if (Propel::isError($objs)) { return $objs; }
1169      }
1170      return $objs;
1171    }
1172  
1173  <?php } else  {  // pkey count > 1
1174  
1175  $comma = false;
1176  ?>
1177    /**
1178    * Retrieve object using pk values or <em>NULL</em> if not found.
1179    *
1180  <?php foreach ($table->getPrimaryKey() as $col) {
1181    $clo = strtolower($col->getName());
1182    $cptype = $col->getPhpNative();
1183  ?> 
1184    * @param <?php echo $cptype ?> $<?php echo $clo ?>
1185  <?php } ?>
1186    * @param Connection $con
1187    *
1188    * @return <?php echo $table->getPhpName() ?>
1189    */
1190    function <?php echo $retrieveMethod ?>(<?php foreach ($table->getPrimaryKey() as $col) { $clo = strtolower($col->getName()); ?><?php if ($comma) { ?>,<?php } ?> $<?php echo $clo ?><?php $comma = true; ?><?php } /* foreach */ ?>, $con = null)
1191    {
1192      /* [MA] temporarily check */
1193      Propel::assertParam($con, '<?php echo $CLASS; ?>', '<?php echo $retrieveMethod ?>', -1);
1194  
1195      $criteria = new Criteria();
1196  <?php foreach ($table->getPrimaryKey() as $col) {
1197    $clo = strtolower($col->getName());
1198  ?>
1199      $criteria->add(<?php echo $table->getPhpName()?>Peer::<?php echo PeerBuilder::getColumnName($col) ?>(), $<?php echo $clo ?>);
1200  <?php } ?>
1201  
1202      $v =& <?php echo $table->getPhpName()?>Peer::doSelect($criteria, $con);
1203      return count($v) > 0 ? $v[0] : null;
1204    }
1205  
1206  <?php } /* if pkey > 1 */
1207  
1208  }  /* if pkey > 0 */ ?>
1209  
1210  <?php
1211  
1212  if ($complexObjectModel) {
1213  
1214   //
1215   // setup joins
1216   //
1217   $className = $table->getPhpName();
1218   $countFK = count($table->getForeignKeys());
1219  
1220   if ($countFK >= 1) {
1221    foreach ($table->getForeignKeys() as $fk) {
1222      $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
1223      if (!$tblFK->isForReferenceOnly()) {
1224      // want to cover this other case, but the code is not there yet.
1225        if ( $fk->getForeignTableName() != $table->getName() ) {
1226  
1227          $partJoinName = "";
1228          foreach ($fk->getLocalColumns() as $columnName ) {
1229            $column = $table->getColumn($columnName);
1230            if ($column->isMultipleFK() || $fk->getForeignTableName() == $table->getName()) {
1231              $partJoinName = $partJoinName . $column->getPhpName();
1232            }
1233          }
1234  
1235          $joinTable = $table->getDatabase()->getTable($fk->getForeignTableName());
1236          $joinClassName = $joinTable->getPhpName();
1237          $interfaceName = $joinTable->getPhpName();
1238          if ($joinTable->getInterface()) {
1239             $interfaceName = $joinTable->getInterface();
1240          }
1241  
1242          if ($partJoinName == "") {
1243            $joinColumnId = $joinClassName;
1244            $joinInterface = $interfaceName;
1245            $collThisTable = $className . "s";
1246            $collThisTableMs = $className;
1247          } else {
1248            $joinColumnId= $joinClassName . "RelatedBy" . $partJoinName;
1249            $joinInterface= $interfaceName . "RelatedBy" . $partJoinName;
1250            $collThisTable= $className . "sRelatedBy" . $partJoinName;
1251            $collThisTableMs= $className . "RelatedBy" . $partJoinName;
1252          }
1253  
1254  // ------------------------------------------------------------
1255  ?>
1256    /**
1257    * Selects a collection of <?php echo $className ?> objects pre-filled with their
1258    * <?php echo $joinClassName ?> objects.
1259    *
1260    * @return array Array of <?php echo $className ?> objects.
1261    * @throws PropelException Any exceptions caught during processing will be
1262    *         rethrown wrapped into a PropelException.
1263    */
1264    function & doSelectJoin<?php echo $joinColumnId ?>(/*Criteria*/ $c, $con = null)
1265    {
1266      /* [MA] temporarily check */
1267      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelectJoin<?php echo $joinColumnId; ?>', 2);
1268  
1269      // Set the correct dbName if it has not been overridden
1270      if ($c->getDbName() == Propel::getDefaultDB()) {
1271        $c->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1272      }
1273  
1274      <?php echo $table->getPhpName() ?>Peer::addSelectColumns($c);
1275      $startcol = <?php echo $table->getPhpName() ?>Peer::numColumns() - <?php echo $table->getPhpName() ?>Peer::numLazyLoadColumns() + 1;
1276      <?php echo $joinClassName ?>Peer::addSelectColumns($c);
1277  
1278  <?php
1279     $lfMap = $fk->getLocalForeignMapping();
1280     foreach ($fk->getLocalColumns() as $columnName ) {
1281      $column = $table->getColumn($columnName);
1282      $columnFk = $joinTable->getColumn( $lfMap[$columnName]);
1283  ?>
1284      $c->addJoin(<?php echo PeerBuilder::getColumnName($column, $table->getPhpName()) ?>(), <?php echo PeerBuilder::getColumnName($columnFk,$joinClassName)?>());
1285     <?php } ?>
1286  
1287      $rs =& <?php echo $basePeerClassname ?>::doSelect($c, $con);
1288      if (Propel::isError($rs)) { return $rs; }
1289  
1290      $results = array();
1291  
1292      while($rs->next())
1293      {
1294  <?php if ($table->getChildrenColumn()) { ?>
1295        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass($rs, 1);
1296  <?php } else { ?>
1297        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass();
1298  <?php } ?>
1299  
1300        $cls =& Propel::import($omClass);
1301        if (Propel::isError($cls)) { return $cls; }
1302  
1303        $obj1 =& new $cls();
1304  
1305        $e =& $obj1->hydrate($rs);
1306        if (Propel::isError($e)) { return $e; }
1307  
1308  <?php if ($joinTable->getChildrenColumn()) { ?>
1309        $omClass = <?php echo $joinClassName ?>Peer::getOMClass($rs, $startcol);
1310  <?php } else { ?>
1311        $omClass = <?php echo $joinClassName ?>Peer::getOMClass();
1312  <?php } ?>
1313  
1314        $cls =& Propel::import($omClass);
1315        if (Propel::isError($cls)) { return $cls; }
1316  
1317        $obj2 =& new $cls();
1318  
1319        $e =& $obj2->hydrate($rs, $startcol);
1320        if (Propel::isError($e)) { return $e; }
1321  
1322        $newObject = true;
1323        foreach($results as $temp_obj1)
1324        {
1325          $temp_obj2 =& $temp_obj1->get<?php echo $joinInterface ?>();
1326          if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
1327            $newObject = false;
1328            $temp_obj2->add<?php echo $collThisTableMs ?>($obj1);
1329            break;
1330          }
1331        }
1332        if ($newObject) {
1333          $obj2->init<?php echo $collThisTable ?>();
1334          $obj2->add<?php echo $collThisTableMs ?>($obj1);
1335        }
1336        $results[] =& $obj1;
1337      }
1338  
1339      return $results;
1340    }
1341  <?php
1342      } // if fk table name != this table name
1343     } // if ! is reference only
1344    } // foreach column
1345   } // if count(fk) > 1
1346  
1347  // ===========================================================
1348  
1349    if ($countFK > 1) {
1350      $includeJoinAll = true;
1351      foreach ($table->getForeignKeys() as $fk) {
1352        $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
1353        if ($tblFK->isForReferenceOnly()) {
1354          $includeJoinAll = false;
1355        }
1356      }
1357  
1358      if ($includeJoinAll) {
1359        // ------------------------------------------------------------------------
1360        // doSelectJoinAll()
1361        // ------------------------------------------------------------------------
1362    
1363        //1 ) create the master doSelectJoinAll() method
1364        
1365        $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
1366        
1367        $relatedByCol = "";
1368        foreach ($fk->getLocalColumns() as $columnName) {
1369          $column = $table->getColumn($columnName);
1370          if ($column->isMultipleFK()) {
1371            $relatedByCol .= $column->getPhpName();
1372          }
1373        }
1374      
1375        if ($relatedByCol == "") {
1376          $collThisTable = "$className}s";
1377          $collThisTableMs = $className;
1378        } else {
1379          $collThisTable = $className . "sRelatedBy" . $relatedByCol;
1380          $collThisTableMs = $className . "RelatedBy" . $relatedByCol;
1381        }
1382  ?>
1383  
1384    /**
1385    * Selects a collection of <?php echo $className ?> objects pre-filled with
1386    * all related objects.
1387    *
1388    * @return array Array of <?php echo $className ?> objects.
1389    * @throws PropelException Any exceptions caught during processing will be
1390    *         rethrown wrapped into a PropelException.
1391    */
1392    function doSelectJoinAll(/*Criteria*/ &$c, $con = null)
1393    {
1394      /* [MA] temporarily check */
1395      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelectJoinAll', 2);
1396      
1397      // Set the correct dbName if it has not been overridden
1398      if ($c->getDbName() == Propel::getDefaultDB()) {
1399        $c->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1400      }
1401  
1402      <?php echo $table->getPhpName() ?>Peer::addSelectColumns($c);
1403      $startcol2 = <?php echo $table->getPhpName() ?>Peer::numColumns() - <?php echo $table->getPhpName() ?>Peer::numLazyLoadColumns() + 1;
1404  <?php
1405        $index = 2;
1406        foreach ($table->getForeignKeys() as $fk) {
1407          // want to cover this case, but the code is not there yet.
1408          if ( $fk->getForeignTableName() != $table->getName() ) {
1409            $joinTable = $table->getDatabase()->getTable($fk->getForeignTableName());
1410            $joinClassName = $joinTable->getPhpName();
1411            $new_index = $index + 1;
1412  ?> 
1413      <?php echo $joinClassName ?>Peer::addSelectColumns($c);
1414      $startcol<?php echo $new_index ?> = $startcol<?php echo $index?> + <?php echo $joinClassName ?>Peer::numColumns();
1415  <?php
1416            $index = $new_index;
1417        } // if fk->getForeignTableName != table->getName
1418      } // foreach [sub] foreign keys
1419      
1420      foreach ($table->getForeignKeys() as $fk) {
1421        // want to cover this case, but the code is not there yet.
1422        if ( $fk->getForeignTableName() != $table->getName() ) {
1423          $joinTable = $table->getDatabase()->getTable($fk->getForeignTableName());
1424          $joinClassName = $joinTable->getPhpName();
1425          $lfMap = $fk->getLocalForeignMapping();
1426          foreach ($fk->getLocalColumns() as $columnName ) {
1427            $column = $table->getColumn($columnName);
1428            $columnFk = $joinTable->getColumn( $lfMap[$columnName]);
1429  ?>
1430      $c->addJoin(<?php echo PeerBuilder::getColumnName($column, $table->getPhpName()) ?>(), <?php echo PeerBuilder::getColumnName($columnFk,$joinClassName)?>());
1431  <?php
1432          } // foreach
1433        } // if
1434      } // foreach
1435  ?>
1436  
1437      $rs =& <?php echo $basePeerClassname ?>::doSelect($c, $con);
1438      if (Propel::isError($rs)) { return $rs; }
1439      $results = array();
1440      
1441      while($rs->next()) {
1442  <?php 
1443      if ($table->getChildrenColumn()) { 
1444  ?> 
1445        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass($rs, 1);
1446  <?php 
1447      } else {
1448  ?> 
1449        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass();
1450  <?php 
1451      } 
1452  ?>
1453        
1454        $cls = Propel::import($omClass);
1455        if (Propel::isError($cls)) { return $cls; }
1456        
1457        $obj1 =& new $cls();
1458        
1459        $e =& $obj1->hydrate($rs);
1460        if (Propel::isError($e)) { return $e; }
1461  <?php
1462      $index = 1;
1463      foreach ($table->getForeignKeys() as $fk ) {
1464        // want to cover this case, but the code is not there yet.
1465        if ( $fk->getForeignTableName() != $table->getName() ) {
1466          $joinTable = $table->getDatabase()->getTable($fk->getForeignTableName());
1467          $joinClassName = $joinTable->getPhpName();
1468          $interfaceName = $joinTable->getPhpName();
1469          if($joinTable->getInterface()) {
1470            $interfaceName = $joinTable->getInterface();
1471          }
1472          
1473          $partJoinName = "";
1474          foreach ($fk->getLocalColumns() as $columnName ) {
1475            $column = $table->getColumn($columnName);
1476            if ($column->isMultipleFK()) {
1477              $partJoinName .= $column->getPhpName();
1478            }
1479          }
1480          
1481          if ($partJoinName == "") {
1482            $joinString = $interfaceName;
1483            $collThisTable = "$className}s";
1484            $collThisTableMs = $className;
1485          } else {
1486            $joinString= $interfaceName."RelatedBy" . $partJoinName;
1487            $collThisTable= $className . "sRelatedBy" . $partJoinName;
1488            $collThisTableMs= $className . "RelatedBy" . $partJoinName;
1489          }
1490          
1491          $index++;
1492  ?> 
1493        
1494        // Add objects for joined <?php echo $joinClassName ?> rows
1495  <?php
1496          if ($joinTable->getChildrenColumn()) {
1497  ?> 
1498        $omClass = <?php echo $joinClassName ?>Peer::getOMClass($rs, $startcol<?php echo $index ?>);
1499  <?php   } else { ?>
1500        $omClass = <?php echo $joinClassName ?>Peer::getOMClass();
1501  <?php 
1502          } /* $joinTable->getChildrenColumn() */
1503  ?>
1504    
1505        $cls = Propel::import($omClass);
1506        if (Propel::isError($cls)) { return $cls; }
1507        
1508        $obj<?php echo $index ?> =& new $cls();
1509        
1510        $e = $obj<?php echo $index ?>->hydrate($rs, $startcol<?php echo $index ?>);
1511        if (Propel::isError($e)) { return $e; }
1512        
1513        $newObject = true;
1514        for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
1515          $temp_obj1 =& $results[$j];
1516          $temp_obj<?php echo $index ?> =& $temp_obj1->get<?php echo $joinString ?>();
1517          if ($temp_obj<?php echo $index ?>->getPrimaryKey() === $obj<?php echo $index ?>->getPrimaryKey()) {
1518            $newObject = false;
1519            $temp_obj<?php echo $index ?>->add<?php echo $collThisTableMs ?>($obj1);
1520            break;
1521          }
1522        }
1523        
1524        if ($newObject) {
1525          $obj<?php echo $index ?>->init<?php echo $collThisTable ?>();
1526          $obj<?php echo $index ?>->add<?php echo $collThisTableMs ?>($obj1);
1527        }
1528    <?php
1529  
1530        } // $fk->getForeignTableName() != $table->getName()
1531      } //foreach foreign key
1532  ?>
1533        $results[] =& $obj1;
1534      }
1535      
1536      return $results;
1537    }
1538  <?php   
1539      
1540      // ------------------------------------------------------------------------
1541      // doSelectJoinAllExcept*()
1542      // ------------------------------------------------------------------------
1543      
1544      // 2) create a bunch of doSelectJoinAllExcept*() methods
1545      // -- these were existing in original Torque, so we should keep them for compatibility
1546      
1547      $fkeys = $table->getForeignKeys();  // this sep assignment is necessary otherwise sub-loops over 
1548      foreach ($fkeys as $fk ) {          // getForeignKeys() will cause this to only execute one time.
1549        $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
1550  
1551        $excludeTable = $table->getDatabase()->getTable($fk->getForeignTableName());
1552        $excludeClassName = $excludeTable->getPhpName();
1553  
1554        $relatedByCol = "";
1555        foreach ($fk->getLocalColumns() as $columnName) {
1556          $column = $table->getColumn($columnName);
1557          if ($column->isMultipleFK()) {
1558            $relatedByCol .= $column->getPhpName();
1559          }
1560        }
1561  
1562        if ($relatedByCol == "") {
1563          $excludeString = $excludeClassName;
1564          $collThisTable = "$className}s";
1565          $collThisTableMs = $className;
1566        } else {
1567          $excludeString = $excludeClassName . "RelatedBy" . $relatedByCol;
1568          $collThisTable = $className . "sRelatedBy" . $relatedByCol;
1569          $collThisTableMs = $className . "RelatedBy" . $relatedByCol;
1570        }
1571  ?>
1572  
1573    /**
1574    * Selects a collection of <?php echo $className ?> objects pre-filled with
1575    * all related objects except <?php echo $excludeString ?>.
1576    *
1577    * @return array Array of <?php echo $className ?> objects.
1578    * @throws PropelException Any exceptions caught during processing will be
1579    *     rethrown wrapped into a PropelException.
1580    */
1581    function doSelectJoinAllExcept<?php echo $excludeString ?>(/*Criteria*/ &$c, $con = null)
1582    {
1583      /* [MA] temporarily check */
1584      Propel::assertParam($con, '<?php echo $CLASS; ?>', 'doSelectJoinAllExcept<?php echo $excludeString; ?>', 2);
1585      
1586      // Set the correct dbName if it has not been overridden
1587      // $c->getDbName() will return the same object if not set to another value
1588      // so == check is okay and faster
1589      if ($c->getDbName() == Propel::getDefaultDB()) {
1590        $c->setDbName(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1591      }
1592  
1593      <?php echo $table->getPhpName() ?>Peer::addSelectColumns($c);
1594      $startcol2 = <?php echo $table->getPhpName() ?>Peer::numColumns() - <?php echo $table->getPhpName() ?>Peer::numLazyLoadColumns() + 1;
1595  <?php
1596        $index = 2;
1597        foreach ($table->getForeignKeys() as $subfk) {
1598          // want to cover this case, but the code is not there yet.
1599        if ( !($subfk->getForeignTableName() == $table->getName())) {
1600          $joinTable = $table->getDatabase()->getTable($subfk->getForeignTableName());
1601          $joinClassName = $joinTable->getPhpName();
1602    
1603          if ($joinClassName != $excludeClassName) {
1604            $new_index = $index + 1;
1605  ?> 
1606      <?php echo $joinClassName ?>Peer::addSelectColumns($c);
1607      $startcol<?php echo $new_index ?> = $startcol<?php echo $index?> + <?php echo $joinClassName ?>Peer::numColumns();
1608  <?php
1609            $index = $new_index;
1610          } 
1611        }
1612      } // foreach [sub] foreign keys    
1613      
1614      foreach ($table->getForeignKeys() as $subfk) {
1615        // want to cover this case, but the code is not there yet.
1616        if ( $subfk->getForeignTableName() != $table->getName() ) {
1617          $joinTable = $table->getDatabase()->getTable($subfk->getForeignTableName());
1618          $joinClassName = $joinTable->getPhpName();
1619          if($joinClassName != $excludeClassName)
1620          {
1621            $lfMap = $subfk->getLocalForeignMapping();
1622            foreach ($subfk->getLocalColumns() as $columnName ) {
1623              $column = $table->getColumn($columnName);
1624              $columnFk = $joinTable->getColumn( $lfMap[$columnName]);
1625  ?>
1626      $c->addJoin(<?php echo PeerBuilder::getColumnName($column, $table->getPhpName()) ?>(), <?php echo PeerBuilder::getColumnName($columnFk,$joinClassName)?>());
1627  <?php
1628            }
1629          }
1630        }
1631      }
1632  ?>
1633  
1634      $rs =& <?php echo $basePeerClassname ?>::doSelect($c, $con);
1635      if (Propel::isError($rs)) { return $rs; }
1636      
1637      $results = array();
1638      
1639      while($rs->next()) {
1640  <?php
1641      if ($table->getChildrenColumn()) {
1642  ?> 
1643        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass($rs, 1);
1644  <?php
1645      } else {
1646  ?> 
1647        $omClass = <?php echo $table->getPhpName() ?>Peer::getOMClass();
1648  <?php
1649      }
1650  ?>
1651        
1652        $cls = Propel::import($omClass);
1653        if (Propel::isError($cls)) { return $cls; }
1654        
1655        $obj1 =& new $cls();
1656        $e = $obj1->hydrate($rs);
1657        if (Propel::isError($e)) { return $e; }
1658        
1659  <?php
1660      $index = 1;
1661      foreach ($table->getForeignKeys() as $subfk ) {
1662        // want to cover this case, but the code is not there yet.
1663        if ( $subfk->getForeignTableName() != $table->getName() ) {
1664          $joinTable = $table->getDatabase()->getTable($subfk->getForeignTableName());
1665          $joinClassName = $joinTable->getPhpName();
1666          $interfaceName = $joinTable->getPhpName();
1667  
1668          if($joinTable->getInterface()) {
1669            $interfaceName = $joinTable->getInterface();
1670          }
1671  
1672          if ($joinClassName != $excludeClassName) {
1673            $partJoinName = "";
1674            foreach ($subfk->getLocalColumns() as $columnName ) {
1675              $column = $table->getColumn($columnName);
1676              if ($column->isMultipleFK()) {
1677                $partJoinName .= $column->getPhpName();
1678              }
1679            }
1680  
1681            if ($partJoinName == "") {
1682              $joinString = $interfaceName;
1683              $collThisTable = "$className}s";
1684              $collThisTableMs = $className;
1685            } else {
1686              $joinString= $interfaceName."RelatedBy" . $partJoinName;
1687              $collThisTable= $className . "sRelatedBy" . $partJoinName;
1688              $collThisTableMs= $className . "RelatedBy" . $partJoinName;
1689            }
1690  
1691            $index++;
1692  
1693            if ($joinTable->getChildrenColumn()) {
1694  ?>
1695        $omClass = <?php echo $joinClassName ?>Peer::getOMClass($rs, $startcol<?php echo $index ?>);
1696  <?php     } else { ?>
1697        $omClass = <?php echo $joinClassName ?>Peer::getOMClass();
1698  <?php 
1699            } /* $joinTable->getChildrenColumn() */
1700  ?>
1701    
1702        $cls = Propel::import($omClass);
1703        if (Propel::isError($cls)) { return $cls; }
1704        
1705        $obj<?php echo $index ?>  =& new $cls();
1706        
1707        $e = $obj<?php echo $index ?>->hydrate($rs, $startcol<?php echo $index ?>);
1708        if (Propel::isError($e)) { return $e; }
1709        
1710        $newObject = true;
1711        for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
1712          $temp_obj1 =& $results[$j];
1713          $temp_obj<?php echo $index ?> =& $temp_obj1->get<?php echo $joinString ?>();
1714          if ($temp_obj<?php echo $index ?>->getPrimaryKey() === $obj<?php echo $index ?>->getPrimaryKey()) {
1715            $newObject = false;
1716            $temp_obj<?php echo $index ?>->add<?php echo $collThisTableMs ?>($obj1);
1717            break;
1718          }
1719        }
1720        
1721        if ($newObject) {
1722          $obj<?php echo $index ?>->init<?php echo $collThisTable ?>();
1723          $obj<?php echo $index ?>->add<?php echo $collThisTableMs ?>($obj1);
1724        }
1725    <?php
1726          } // if ($joinClassName != $excludeClassName) {
1727        } // $subfk->getForeignTableName() != $table->getName()
1728      } // foreach  
1729  ?>
1730        $results[] =& $obj1;
1731      }
1732      
1733      return $results;
1734    }
1735  <?php
1736         } // foreach fk
1737           // end of doSelectJoinAllExcept*() block
1738       } // if includeJoinAll
1739     } /* if count($fk) > 2 */
1740   } /* if complex object model */
1741  
1742   // two extra #end ...
1743  
1744  
1745  //------------------------------------------------------------
1746  
1747  if (!$table->isAlias()) {
1748  ?>
1749    /**
1750     * Returns the TableMap related to this peer.  This method is not
1751     * needed for general use but a specific application could have a need.
1752     * @return TableMap
1753     * @throws PropelException Any exceptions caught during processing will be
1754     *         rethrown wrapped into a PropelException.
1755     */
1756    function & getTableMap()
1757    {
1758      $dbMap =& Propel::getDatabaseMap(<?php echo $table->getPhpName()?>Peer::DATABASE_NAME());
1759      if (Propel::isError($dbMap)) {
1760        return $dbMap;
1761      }
1762      return $dbMap->getTable(<?php echo $table->getPhpName()?>Peer::TABLE_NAME());
1763    }
1764  
1765  <?php } /* !table->isalias */ ?>
1766  }
1767  
1768  // static code to register the map builder for this Peer with the main Propel class
1769  if (Propel::isInit()) {
1770    // the MapBuilder classes register themselves with Propel during initialization
1771    // so we need to load them here.
1772    if (Propel::isError($e = <?php echo $basePrefix . $table->getPhpName() ?>Peer::getMapBuilder())) {
1773      Propel::log("Could not initialize Peer: " . $e->getMessage(), PROPEL_LOG_ERR);
1774    }
1775  } else {
1776    // even if Propel is not yet initialized, the map builder class can be registered
1777    // now and then it will be loaded when Propel initializes.
1778    require_once '<?php echo ClassTools::getFilePath($pkmap, $table->getPhpName() . 'MapBuilder') ?>';
1779    Propel::registerMapBuilder(<?php echo $table->getPhpName()?>MapBuilder::CLASS_NAME());
1780  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7