Overview

Namespaces

  • cli_db
    • propel
      • map
      • om
  • cli_import
  • LoggedPDO
  • None
  • PHP
  • webservices
    • cart
    • combisearch
    • details
      • annotations
        • feature
    • graphs
      • barplot
      • genome
    • listing
    • queue

Classes

  • BaseAcquisition
  • BaseAcquisitionPeer
  • BaseAcquisitionQuery
  • BaseAnalysis
  • BaseAnalysisPeer
  • BaseAnalysisQuery
  • BaseAssay
  • BaseAssayBiomaterial
  • BaseAssayBiomaterialPeer
  • BaseAssayBiomaterialQuery
  • BaseAssayPeer
  • BaseAssayQuery
  • BaseBiomaterial
  • BaseBiomaterialPeer
  • BaseBiomaterialprop
  • BaseBiomaterialpropPeer
  • BaseBiomaterialpropQuery
  • BaseBiomaterialQuery
  • BaseBiomaterialRelationship
  • BaseBiomaterialRelationshipPeer
  • BaseBiomaterialRelationshipQuery
  • BaseContact
  • BaseContactPeer
  • BaseContactQuery
  • BaseCv
  • BaseCvPeer
  • BaseCvQuery
  • BaseCvterm
  • BaseCvtermPeer
  • BaseCvtermQuery
  • BaseDb
  • BaseDbPeer
  • BaseDbQuery
  • BaseDbxref
  • BaseDbxrefPeer
  • BaseDbxrefQuery
  • BaseFeature
  • BaseFeatureCvterm
  • BaseFeatureCvtermDbxref
  • BaseFeatureCvtermDbxrefPeer
  • BaseFeatureCvtermDbxrefQuery
  • BaseFeatureCvtermPeer
  • BaseFeatureCvtermprop
  • BaseFeatureCvtermpropPeer
  • BaseFeatureCvtermpropQuery
  • BaseFeatureCvtermPub
  • BaseFeatureCvtermPubPeer
  • BaseFeatureCvtermPubQuery
  • BaseFeatureCvtermQuery
  • BaseFeatureDbxref
  • BaseFeatureDbxrefPeer
  • BaseFeatureDbxrefQuery
  • BaseFeaturePeer
  • BaseFeaturePub
  • BaseFeaturePubPeer
  • BaseFeaturePubQuery
  • BaseFeatureQuery
  • BaseFeatureSynonym
  • BaseFeatureSynonymPeer
  • BaseFeatureSynonymQuery
  • BaseOrganism
  • BaseOrganismPeer
  • BaseOrganismQuery
  • BaseProtocol
  • BaseProtocolPeer
  • BaseProtocolQuery
  • BasePub
  • BasePubauthor
  • BasePubauthorPeer
  • BasePubauthorQuery
  • BasePubDbxref
  • BasePubDbxrefPeer
  • BasePubDbxrefQuery
  • BasePubPeer
  • BasePubprop
  • BasePubpropPeer
  • BasePubpropQuery
  • BasePubQuery
  • BasePubRelationship
  • BasePubRelationshipPeer
  • BasePubRelationshipQuery
  • BaseQuantification
  • BaseQuantificationPeer
  • BaseQuantificationQuery
  • BaseSynonym
  • BaseSynonymPeer
  • BaseSynonymQuery
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: 
   3: namespace cli_db\propel\om;
   4: 
   5: use \BasePeer;
   6: use \Criteria;
   7: use \PDO;
   8: use \PDOStatement;
   9: use \Propel;
  10: use \PropelException;
  11: use \PropelPDO;
  12: use cli_db\propel\CvtermPeer;
  13: use cli_db\propel\FeatureSynonymPeer;
  14: use cli_db\propel\Synonym;
  15: use cli_db\propel\SynonymPeer;
  16: use cli_db\propel\map\SynonymTableMap;
  17: 
  18: /**
  19:  * Base static class for performing query and update operations on the 'synonym' table.
  20:  *
  21:  *
  22:  *
  23:  * @package propel.generator.cli_db.om
  24:  */
  25: abstract class BaseSynonymPeer
  26: {
  27: 
  28:     /** the default database name for this class */
  29:     const DATABASE_NAME = 'cli_db';
  30: 
  31:     /** the table name for this class */
  32:     const TABLE_NAME = 'synonym';
  33: 
  34:     /** the related Propel class for this table */
  35:     const OM_CLASS = 'cli_db\\propel\\Synonym';
  36: 
  37:     /** the related TableMap class for this table */
  38:     const TM_CLASS = 'SynonymTableMap';
  39: 
  40:     /** The total number of columns. */
  41:     const NUM_COLUMNS = 4;
  42: 
  43:     /** The number of lazy-loaded columns. */
  44:     const NUM_LAZY_LOAD_COLUMNS = 0;
  45: 
  46:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  47:     const NUM_HYDRATE_COLUMNS = 4;
  48: 
  49:     /** the column name for the synonym_id field */
  50:     const SYNONYM_ID = 'synonym.synonym_id';
  51: 
  52:     /** the column name for the name field */
  53:     const NAME = 'synonym.name';
  54: 
  55:     /** the column name for the type_id field */
  56:     const TYPE_ID = 'synonym.type_id';
  57: 
  58:     /** the column name for the synonym_sgml field */
  59:     const SYNONYM_SGML = 'synonym.synonym_sgml';
  60: 
  61:     /** The default string format for model objects of the related table **/
  62:     const DEFAULT_STRING_FORMAT = 'YAML';
  63: 
  64:     /**
  65:      * An identiy map to hold any loaded instances of Synonym objects.
  66:      * This must be public so that other peer classes can access this when hydrating from JOIN
  67:      * queries.
  68:      * @var        array Synonym[]
  69:      */
  70:     public static $instances = array();
  71: 
  72: 
  73:     /**
  74:      * holds an array of fieldnames
  75:      *
  76:      * first dimension keys are the type constants
  77:      * e.g. SynonymPeer::$fieldNames[SynonymPeer::TYPE_PHPNAME][0] = 'Id'
  78:      */
  79:     protected static $fieldNames = array (
  80:         BasePeer::TYPE_PHPNAME => array ('SynonymId', 'Name', 'TypeId', 'SynonymSgml', ),
  81:         BasePeer::TYPE_STUDLYPHPNAME => array ('synonymId', 'name', 'typeId', 'synonymSgml', ),
  82:         BasePeer::TYPE_COLNAME => array (SynonymPeer::SYNONYM_ID, SynonymPeer::NAME, SynonymPeer::TYPE_ID, SynonymPeer::SYNONYM_SGML, ),
  83:         BasePeer::TYPE_RAW_COLNAME => array ('SYNONYM_ID', 'NAME', 'TYPE_ID', 'SYNONYM_SGML', ),
  84:         BasePeer::TYPE_FIELDNAME => array ('synonym_id', 'name', 'type_id', 'synonym_sgml', ),
  85:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
  86:     );
  87: 
  88:     /**
  89:      * holds an array of keys for quick access to the fieldnames array
  90:      *
  91:      * first dimension keys are the type constants
  92:      * e.g. SynonymPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  93:      */
  94:     protected static $fieldKeys = array (
  95:         BasePeer::TYPE_PHPNAME => array ('SynonymId' => 0, 'Name' => 1, 'TypeId' => 2, 'SynonymSgml' => 3, ),
  96:         BasePeer::TYPE_STUDLYPHPNAME => array ('synonymId' => 0, 'name' => 1, 'typeId' => 2, 'synonymSgml' => 3, ),
  97:         BasePeer::TYPE_COLNAME => array (SynonymPeer::SYNONYM_ID => 0, SynonymPeer::NAME => 1, SynonymPeer::TYPE_ID => 2, SynonymPeer::SYNONYM_SGML => 3, ),
  98:         BasePeer::TYPE_RAW_COLNAME => array ('SYNONYM_ID' => 0, 'NAME' => 1, 'TYPE_ID' => 2, 'SYNONYM_SGML' => 3, ),
  99:         BasePeer::TYPE_FIELDNAME => array ('synonym_id' => 0, 'name' => 1, 'type_id' => 2, 'synonym_sgml' => 3, ),
 100:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
 101:     );
 102: 
 103:     /**
 104:      * Translates a fieldname to another type
 105:      *
 106:      * @param      string $name field name
 107:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 108:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 109:      * @param      string $toType   One of the class type constants
 110:      * @return string          translated name of the field.
 111:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 112:      */
 113:     public static function translateFieldName($name, $fromType, $toType)
 114:     {
 115:         $toNames = SynonymPeer::getFieldNames($toType);
 116:         $key = isset(SynonymPeer::$fieldKeys[$fromType][$name]) ? SynonymPeer::$fieldKeys[$fromType][$name] : null;
 117:         if ($key === null) {
 118:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(SynonymPeer::$fieldKeys[$fromType], true));
 119:         }
 120: 
 121:         return $toNames[$key];
 122:     }
 123: 
 124:     /**
 125:      * Returns an array of field names.
 126:      *
 127:      * @param      string $type The type of fieldnames to return:
 128:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 129:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 130:      * @return array           A list of field names
 131:      * @throws PropelException - if the type is not valid.
 132:      */
 133:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 134:     {
 135:         if (!array_key_exists($type, SynonymPeer::$fieldNames)) {
 136:             throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
 137:         }
 138: 
 139:         return SynonymPeer::$fieldNames[$type];
 140:     }
 141: 
 142:     /**
 143:      * Convenience method which changes table.column to alias.column.
 144:      *
 145:      * Using this method you can maintain SQL abstraction while using column aliases.
 146:      * <code>
 147:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 148:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 149:      * </code>
 150:      * @param      string $alias The alias for the current table.
 151:      * @param      string $column The column name for current table. (i.e. SynonymPeer::COLUMN_NAME).
 152:      * @return string
 153:      */
 154:     public static function alias($alias, $column)
 155:     {
 156:         return str_replace(SynonymPeer::TABLE_NAME.'.', $alias.'.', $column);
 157:     }
 158: 
 159:     /**
 160:      * Add all the columns needed to create a new object.
 161:      *
 162:      * Note: any columns that were marked with lazyLoad="true" in the
 163:      * XML schema will not be added to the select list and only loaded
 164:      * on demand.
 165:      *
 166:      * @param      Criteria $criteria object containing the columns to add.
 167:      * @param      string   $alias    optional table alias
 168:      * @throws PropelException Any exceptions caught during processing will be
 169:      *       rethrown wrapped into a PropelException.
 170:      */
 171:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 172:     {
 173:         if (null === $alias) {
 174:             $criteria->addSelectColumn(SynonymPeer::SYNONYM_ID);
 175:             $criteria->addSelectColumn(SynonymPeer::NAME);
 176:             $criteria->addSelectColumn(SynonymPeer::TYPE_ID);
 177:             $criteria->addSelectColumn(SynonymPeer::SYNONYM_SGML);
 178:         } else {
 179:             $criteria->addSelectColumn($alias . '.synonym_id');
 180:             $criteria->addSelectColumn($alias . '.name');
 181:             $criteria->addSelectColumn($alias . '.type_id');
 182:             $criteria->addSelectColumn($alias . '.synonym_sgml');
 183:         }
 184:     }
 185: 
 186:     /**
 187:      * Returns the number of rows matching criteria.
 188:      *
 189:      * @param      Criteria $criteria
 190:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 191:      * @param      PropelPDO $con
 192:      * @return int Number of matching rows.
 193:      */
 194:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 195:     {
 196:         // we may modify criteria, so copy it first
 197:         $criteria = clone $criteria;
 198: 
 199:         // We need to set the primary table name, since in the case that there are no WHERE columns
 200:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 201:         // tables go into the FROM clause.
 202:         $criteria->setPrimaryTableName(SynonymPeer::TABLE_NAME);
 203: 
 204:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 205:             $criteria->setDistinct();
 206:         }
 207: 
 208:         if (!$criteria->hasSelectClause()) {
 209:             SynonymPeer::addSelectColumns($criteria);
 210:         }
 211: 
 212:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 213:         $criteria->setDbName(SynonymPeer::DATABASE_NAME); // Set the correct dbName
 214: 
 215:         if ($con === null) {
 216:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 217:         }
 218:         // BasePeer returns a PDOStatement
 219:         $stmt = BasePeer::doCount($criteria, $con);
 220: 
 221:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 222:             $count = (int) $row[0];
 223:         } else {
 224:             $count = 0; // no rows returned; we infer that means 0 matches.
 225:         }
 226:         $stmt->closeCursor();
 227: 
 228:         return $count;
 229:     }
 230:     /**
 231:      * Selects one object from the DB.
 232:      *
 233:      * @param      Criteria $criteria object used to create the SELECT statement.
 234:      * @param      PropelPDO $con
 235:      * @return                 Synonym
 236:      * @throws PropelException Any exceptions caught during processing will be
 237:      *       rethrown wrapped into a PropelException.
 238:      */
 239:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 240:     {
 241:         $critcopy = clone $criteria;
 242:         $critcopy->setLimit(1);
 243:         $objects = SynonymPeer::doSelect($critcopy, $con);
 244:         if ($objects) {
 245:             return $objects[0];
 246:         }
 247: 
 248:         return null;
 249:     }
 250:     /**
 251:      * Selects several row from the DB.
 252:      *
 253:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 254:      * @param      PropelPDO $con
 255:      * @return array           Array of selected Objects
 256:      * @throws PropelException Any exceptions caught during processing will be
 257:      *       rethrown wrapped into a PropelException.
 258:      */
 259:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 260:     {
 261:         return SynonymPeer::populateObjects(SynonymPeer::doSelectStmt($criteria, $con));
 262:     }
 263:     /**
 264:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 265:      *
 266:      * Use this method directly if you want to work with an executed statement directly (for example
 267:      * to perform your own object hydration).
 268:      *
 269:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 270:      * @param      PropelPDO $con The connection to use
 271:      * @throws PropelException Any exceptions caught during processing will be
 272:      *       rethrown wrapped into a PropelException.
 273:      * @return PDOStatement The executed PDOStatement object.
 274:      * @see        BasePeer::doSelect()
 275:      */
 276:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 277:     {
 278:         if ($con === null) {
 279:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 280:         }
 281: 
 282:         if (!$criteria->hasSelectClause()) {
 283:             $criteria = clone $criteria;
 284:             SynonymPeer::addSelectColumns($criteria);
 285:         }
 286: 
 287:         // Set the correct dbName
 288:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 289: 
 290:         // BasePeer returns a PDOStatement
 291:         return BasePeer::doSelect($criteria, $con);
 292:     }
 293:     /**
 294:      * Adds an object to the instance pool.
 295:      *
 296:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 297:      * from the database.  In some cases -- especially when you override doSelect*()
 298:      * methods in your stub classes -- you may need to explicitly add objects
 299:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 300:      * and retrieveByPK*() calls.
 301:      *
 302:      * @param      Synonym $obj A Synonym object.
 303:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 304:      */
 305:     public static function addInstanceToPool($obj, $key = null)
 306:     {
 307:         if (Propel::isInstancePoolingEnabled()) {
 308:             if ($key === null) {
 309:                 $key = (string) $obj->getSynonymId();
 310:             } // if key === null
 311:             SynonymPeer::$instances[$key] = $obj;
 312:         }
 313:     }
 314: 
 315:     /**
 316:      * Removes an object from the instance pool.
 317:      *
 318:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 319:      * from the database.  In some cases -- especially when you override doDelete
 320:      * methods in your stub classes -- you may need to explicitly remove objects
 321:      * from the cache in order to prevent returning objects that no longer exist.
 322:      *
 323:      * @param      mixed $value A Synonym object or a primary key value.
 324:      *
 325:      * @return void
 326:      * @throws PropelException - if the value is invalid.
 327:      */
 328:     public static function removeInstanceFromPool($value)
 329:     {
 330:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 331:             if (is_object($value) && $value instanceof Synonym) {
 332:                 $key = (string) $value->getSynonymId();
 333:             } elseif (is_scalar($value)) {
 334:                 // assume we've been passed a primary key
 335:                 $key = (string) $value;
 336:             } else {
 337:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Synonym object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 338:                 throw $e;
 339:             }
 340: 
 341:             unset(SynonymPeer::$instances[$key]);
 342:         }
 343:     } // removeInstanceFromPool()
 344: 
 345:     /**
 346:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 347:      *
 348:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 349:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 350:      *
 351:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 352:      * @return   Synonym Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 353:      * @see        getPrimaryKeyHash()
 354:      */
 355:     public static function getInstanceFromPool($key)
 356:     {
 357:         if (Propel::isInstancePoolingEnabled()) {
 358:             if (isset(SynonymPeer::$instances[$key])) {
 359:                 return SynonymPeer::$instances[$key];
 360:             }
 361:         }
 362: 
 363:         return null; // just to be explicit
 364:     }
 365: 
 366:     /**
 367:      * Clear the instance pool.
 368:      *
 369:      * @return void
 370:      */
 371:     public static function clearInstancePool($and_clear_all_references = false)
 372:     {
 373:       if ($and_clear_all_references)
 374:       {
 375:         foreach (SynonymPeer::$instances as $instance)
 376:         {
 377:           $instance->clearAllReferences(true);
 378:         }
 379:       }
 380:         SynonymPeer::$instances = array();
 381:     }
 382: 
 383:     /**
 384:      * Method to invalidate the instance pool of all tables related to synonym
 385:      * by a foreign key with ON DELETE CASCADE
 386:      */
 387:     public static function clearRelatedInstancePool()
 388:     {
 389:         // Invalidate objects in FeatureSynonymPeer instance pool,
 390:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 391:         FeatureSynonymPeer::clearInstancePool();
 392:     }
 393: 
 394:     /**
 395:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 396:      *
 397:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 398:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 399:      *
 400:      * @param      array $row PropelPDO resultset row.
 401:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 402:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 403:      */
 404:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 405:     {
 406:         // If the PK cannot be derived from the row, return null.
 407:         if ($row[$startcol] === null) {
 408:             return null;
 409:         }
 410: 
 411:         return (string) $row[$startcol];
 412:     }
 413: 
 414:     /**
 415:      * Retrieves the primary key from the DB resultset row
 416:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 417:      * a multi-column primary key, an array of the primary key columns will be returned.
 418:      *
 419:      * @param      array $row PropelPDO resultset row.
 420:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 421:      * @return mixed The primary key of the row
 422:      */
 423:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 424:     {
 425: 
 426:         return (int) $row[$startcol];
 427:     }
 428: 
 429:     /**
 430:      * The returned array will contain objects of the default type or
 431:      * objects that inherit from the default.
 432:      *
 433:      * @throws PropelException Any exceptions caught during processing will be
 434:      *       rethrown wrapped into a PropelException.
 435:      */
 436:     public static function populateObjects(PDOStatement $stmt)
 437:     {
 438:         $results = array();
 439: 
 440:         // set the class once to avoid overhead in the loop
 441:         $cls = SynonymPeer::getOMClass();
 442:         // populate the object(s)
 443:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 444:             $key = SynonymPeer::getPrimaryKeyHashFromRow($row, 0);
 445:             if (null !== ($obj = SynonymPeer::getInstanceFromPool($key))) {
 446:                 // We no longer rehydrate the object, since this can cause data loss.
 447:                 // See http://www.propelorm.org/ticket/509
 448:                 // $obj->hydrate($row, 0, true); // rehydrate
 449:                 $results[] = $obj;
 450:             } else {
 451:                 $obj = new $cls();
 452:                 $obj->hydrate($row);
 453:                 $results[] = $obj;
 454:                 SynonymPeer::addInstanceToPool($obj, $key);
 455:             } // if key exists
 456:         }
 457:         $stmt->closeCursor();
 458: 
 459:         return $results;
 460:     }
 461:     /**
 462:      * Populates an object of the default type or an object that inherit from the default.
 463:      *
 464:      * @param      array $row PropelPDO resultset row.
 465:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 466:      * @throws PropelException Any exceptions caught during processing will be
 467:      *       rethrown wrapped into a PropelException.
 468:      * @return array (Synonym object, last column rank)
 469:      */
 470:     public static function populateObject($row, $startcol = 0)
 471:     {
 472:         $key = SynonymPeer::getPrimaryKeyHashFromRow($row, $startcol);
 473:         if (null !== ($obj = SynonymPeer::getInstanceFromPool($key))) {
 474:             // We no longer rehydrate the object, since this can cause data loss.
 475:             // See http://www.propelorm.org/ticket/509
 476:             // $obj->hydrate($row, $startcol, true); // rehydrate
 477:             $col = $startcol + SynonymPeer::NUM_HYDRATE_COLUMNS;
 478:         } else {
 479:             $cls = SynonymPeer::OM_CLASS;
 480:             $obj = new $cls();
 481:             $col = $obj->hydrate($row, $startcol);
 482:             SynonymPeer::addInstanceToPool($obj, $key);
 483:         }
 484: 
 485:         return array($obj, $col);
 486:     }
 487: 
 488: 
 489:     /**
 490:      * Returns the number of rows matching criteria, joining the related Cvterm table
 491:      *
 492:      * @param      Criteria $criteria
 493:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 494:      * @param      PropelPDO $con
 495:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 496:      * @return int Number of matching rows.
 497:      */
 498:     public static function doCountJoinCvterm(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 499:     {
 500:         // we're going to modify criteria, so copy it first
 501:         $criteria = clone $criteria;
 502: 
 503:         // We need to set the primary table name, since in the case that there are no WHERE columns
 504:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 505:         // tables go into the FROM clause.
 506:         $criteria->setPrimaryTableName(SynonymPeer::TABLE_NAME);
 507: 
 508:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 509:             $criteria->setDistinct();
 510:         }
 511: 
 512:         if (!$criteria->hasSelectClause()) {
 513:             SynonymPeer::addSelectColumns($criteria);
 514:         }
 515: 
 516:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 517: 
 518:         // Set the correct dbName
 519:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 520: 
 521:         if ($con === null) {
 522:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 523:         }
 524: 
 525:         $criteria->addJoin(SynonymPeer::TYPE_ID, CvtermPeer::CVTERM_ID, $join_behavior);
 526: 
 527:         $stmt = BasePeer::doCount($criteria, $con);
 528: 
 529:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 530:             $count = (int) $row[0];
 531:         } else {
 532:             $count = 0; // no rows returned; we infer that means 0 matches.
 533:         }
 534:         $stmt->closeCursor();
 535: 
 536:         return $count;
 537:     }
 538: 
 539: 
 540:     /**
 541:      * Selects a collection of Synonym objects pre-filled with their Cvterm objects.
 542:      * @param      Criteria  $criteria
 543:      * @param      PropelPDO $con
 544:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 545:      * @return array           Array of Synonym objects.
 546:      * @throws PropelException Any exceptions caught during processing will be
 547:      *       rethrown wrapped into a PropelException.
 548:      */
 549:     public static function doSelectJoinCvterm(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 550:     {
 551:         $criteria = clone $criteria;
 552: 
 553:         // Set the correct dbName if it has not been overridden
 554:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 555:             $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 556:         }
 557: 
 558:         SynonymPeer::addSelectColumns($criteria);
 559:         $startcol = SynonymPeer::NUM_HYDRATE_COLUMNS;
 560:         CvtermPeer::addSelectColumns($criteria);
 561: 
 562:         $criteria->addJoin(SynonymPeer::TYPE_ID, CvtermPeer::CVTERM_ID, $join_behavior);
 563: 
 564:         $stmt = BasePeer::doSelect($criteria, $con);
 565:         $results = array();
 566: 
 567:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 568:             $key1 = SynonymPeer::getPrimaryKeyHashFromRow($row, 0);
 569:             if (null !== ($obj1 = SynonymPeer::getInstanceFromPool($key1))) {
 570:                 // We no longer rehydrate the object, since this can cause data loss.
 571:                 // See http://www.propelorm.org/ticket/509
 572:                 // $obj1->hydrate($row, 0, true); // rehydrate
 573:             } else {
 574: 
 575:                 $cls = SynonymPeer::getOMClass();
 576: 
 577:                 $obj1 = new $cls();
 578:                 $obj1->hydrate($row);
 579:                 SynonymPeer::addInstanceToPool($obj1, $key1);
 580:             } // if $obj1 already loaded
 581: 
 582:             $key2 = CvtermPeer::getPrimaryKeyHashFromRow($row, $startcol);
 583:             if ($key2 !== null) {
 584:                 $obj2 = CvtermPeer::getInstanceFromPool($key2);
 585:                 if (!$obj2) {
 586: 
 587:                     $cls = CvtermPeer::getOMClass();
 588: 
 589:                     $obj2 = new $cls();
 590:                     $obj2->hydrate($row, $startcol);
 591:                     CvtermPeer::addInstanceToPool($obj2, $key2);
 592:                 } // if obj2 already loaded
 593: 
 594:                 // Add the $obj1 (Synonym) to $obj2 (Cvterm)
 595:                 $obj2->addSynonym($obj1);
 596: 
 597:             } // if joined row was not null
 598: 
 599:             $results[] = $obj1;
 600:         }
 601:         $stmt->closeCursor();
 602: 
 603:         return $results;
 604:     }
 605: 
 606: 
 607:     /**
 608:      * Returns the number of rows matching criteria, joining all related tables
 609:      *
 610:      * @param      Criteria $criteria
 611:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 612:      * @param      PropelPDO $con
 613:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 614:      * @return int Number of matching rows.
 615:      */
 616:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 617:     {
 618:         // we're going to modify criteria, so copy it first
 619:         $criteria = clone $criteria;
 620: 
 621:         // We need to set the primary table name, since in the case that there are no WHERE columns
 622:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 623:         // tables go into the FROM clause.
 624:         $criteria->setPrimaryTableName(SynonymPeer::TABLE_NAME);
 625: 
 626:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 627:             $criteria->setDistinct();
 628:         }
 629: 
 630:         if (!$criteria->hasSelectClause()) {
 631:             SynonymPeer::addSelectColumns($criteria);
 632:         }
 633: 
 634:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 635: 
 636:         // Set the correct dbName
 637:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 638: 
 639:         if ($con === null) {
 640:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 641:         }
 642: 
 643:         $criteria->addJoin(SynonymPeer::TYPE_ID, CvtermPeer::CVTERM_ID, $join_behavior);
 644: 
 645:         $stmt = BasePeer::doCount($criteria, $con);
 646: 
 647:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 648:             $count = (int) $row[0];
 649:         } else {
 650:             $count = 0; // no rows returned; we infer that means 0 matches.
 651:         }
 652:         $stmt->closeCursor();
 653: 
 654:         return $count;
 655:     }
 656: 
 657:     /**
 658:      * Selects a collection of Synonym objects pre-filled with all related objects.
 659:      *
 660:      * @param      Criteria  $criteria
 661:      * @param      PropelPDO $con
 662:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 663:      * @return array           Array of Synonym objects.
 664:      * @throws PropelException Any exceptions caught during processing will be
 665:      *       rethrown wrapped into a PropelException.
 666:      */
 667:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 668:     {
 669:         $criteria = clone $criteria;
 670: 
 671:         // Set the correct dbName if it has not been overridden
 672:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 673:             $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 674:         }
 675: 
 676:         SynonymPeer::addSelectColumns($criteria);
 677:         $startcol2 = SynonymPeer::NUM_HYDRATE_COLUMNS;
 678: 
 679:         CvtermPeer::addSelectColumns($criteria);
 680:         $startcol3 = $startcol2 + CvtermPeer::NUM_HYDRATE_COLUMNS;
 681: 
 682:         $criteria->addJoin(SynonymPeer::TYPE_ID, CvtermPeer::CVTERM_ID, $join_behavior);
 683: 
 684:         $stmt = BasePeer::doSelect($criteria, $con);
 685:         $results = array();
 686: 
 687:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 688:             $key1 = SynonymPeer::getPrimaryKeyHashFromRow($row, 0);
 689:             if (null !== ($obj1 = SynonymPeer::getInstanceFromPool($key1))) {
 690:                 // We no longer rehydrate the object, since this can cause data loss.
 691:                 // See http://www.propelorm.org/ticket/509
 692:                 // $obj1->hydrate($row, 0, true); // rehydrate
 693:             } else {
 694:                 $cls = SynonymPeer::getOMClass();
 695: 
 696:                 $obj1 = new $cls();
 697:                 $obj1->hydrate($row);
 698:                 SynonymPeer::addInstanceToPool($obj1, $key1);
 699:             } // if obj1 already loaded
 700: 
 701:             // Add objects for joined Cvterm rows
 702: 
 703:             $key2 = CvtermPeer::getPrimaryKeyHashFromRow($row, $startcol2);
 704:             if ($key2 !== null) {
 705:                 $obj2 = CvtermPeer::getInstanceFromPool($key2);
 706:                 if (!$obj2) {
 707: 
 708:                     $cls = CvtermPeer::getOMClass();
 709: 
 710:                     $obj2 = new $cls();
 711:                     $obj2->hydrate($row, $startcol2);
 712:                     CvtermPeer::addInstanceToPool($obj2, $key2);
 713:                 } // if obj2 loaded
 714: 
 715:                 // Add the $obj1 (Synonym) to the collection in $obj2 (Cvterm)
 716:                 $obj2->addSynonym($obj1);
 717:             } // if joined row not null
 718: 
 719:             $results[] = $obj1;
 720:         }
 721:         $stmt->closeCursor();
 722: 
 723:         return $results;
 724:     }
 725: 
 726:     /**
 727:      * Returns the TableMap related to this peer.
 728:      * This method is not needed for general use but a specific application could have a need.
 729:      * @return TableMap
 730:      * @throws PropelException Any exceptions caught during processing will be
 731:      *       rethrown wrapped into a PropelException.
 732:      */
 733:     public static function getTableMap()
 734:     {
 735:         return Propel::getDatabaseMap(SynonymPeer::DATABASE_NAME)->getTable(SynonymPeer::TABLE_NAME);
 736:     }
 737: 
 738:     /**
 739:      * Add a TableMap instance to the database for this peer class.
 740:      */
 741:     public static function buildTableMap()
 742:     {
 743:       $dbMap = Propel::getDatabaseMap(BaseSynonymPeer::DATABASE_NAME);
 744:       if (!$dbMap->hasTable(BaseSynonymPeer::TABLE_NAME)) {
 745:         $dbMap->addTableObject(new SynonymTableMap());
 746:       }
 747:     }
 748: 
 749:     /**
 750:      * The class that the Peer will make instances of.
 751:      *
 752:      *
 753:      * @return string ClassName
 754:      */
 755:     public static function getOMClass($row = 0, $colnum = 0)
 756:     {
 757:         return SynonymPeer::OM_CLASS;
 758:     }
 759: 
 760:     /**
 761:      * Performs an INSERT on the database, given a Synonym or Criteria object.
 762:      *
 763:      * @param      mixed $values Criteria or Synonym object containing data that is used to create the INSERT statement.
 764:      * @param      PropelPDO $con the PropelPDO connection to use
 765:      * @return mixed           The new primary key.
 766:      * @throws PropelException Any exceptions caught during processing will be
 767:      *       rethrown wrapped into a PropelException.
 768:      */
 769:     public static function doInsert($values, PropelPDO $con = null)
 770:     {
 771:         if ($con === null) {
 772:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 773:         }
 774: 
 775:         if ($values instanceof Criteria) {
 776:             $criteria = clone $values; // rename for clarity
 777:         } else {
 778:             $criteria = $values->buildCriteria(); // build Criteria from Synonym object
 779:         }
 780: 
 781:         if ($criteria->containsKey(SynonymPeer::SYNONYM_ID) && $criteria->keyContainsValue(SynonymPeer::SYNONYM_ID) ) {
 782:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.SynonymPeer::SYNONYM_ID.')');
 783:         }
 784: 
 785: 
 786:         // Set the correct dbName
 787:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 788: 
 789:         try {
 790:             // use transaction because $criteria could contain info
 791:             // for more than one table (I guess, conceivably)
 792:             $con->beginTransaction();
 793:             $pk = BasePeer::doInsert($criteria, $con);
 794:             $con->commit();
 795:         } catch (PropelException $e) {
 796:             $con->rollBack();
 797:             throw $e;
 798:         }
 799: 
 800:         return $pk;
 801:     }
 802: 
 803:     /**
 804:      * Performs an UPDATE on the database, given a Synonym or Criteria object.
 805:      *
 806:      * @param      mixed $values Criteria or Synonym object containing data that is used to create the UPDATE statement.
 807:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
 808:      * @return int             The number of affected rows (if supported by underlying database driver).
 809:      * @throws PropelException Any exceptions caught during processing will be
 810:      *       rethrown wrapped into a PropelException.
 811:      */
 812:     public static function doUpdate($values, PropelPDO $con = null)
 813:     {
 814:         if ($con === null) {
 815:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 816:         }
 817: 
 818:         $selectCriteria = new Criteria(SynonymPeer::DATABASE_NAME);
 819: 
 820:         if ($values instanceof Criteria) {
 821:             $criteria = clone $values; // rename for clarity
 822: 
 823:             $comparison = $criteria->getComparison(SynonymPeer::SYNONYM_ID);
 824:             $value = $criteria->remove(SynonymPeer::SYNONYM_ID);
 825:             if ($value) {
 826:                 $selectCriteria->add(SynonymPeer::SYNONYM_ID, $value, $comparison);
 827:             } else {
 828:                 $selectCriteria->setPrimaryTableName(SynonymPeer::TABLE_NAME);
 829:             }
 830: 
 831:         } else { // $values is Synonym object
 832:             $criteria = $values->buildCriteria(); // gets full criteria
 833:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
 834:         }
 835: 
 836:         // set the correct dbName
 837:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 838: 
 839:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
 840:     }
 841: 
 842:     /**
 843:      * Deletes all rows from the synonym table.
 844:      *
 845:      * @param      PropelPDO $con the connection to use
 846:      * @return int             The number of affected rows (if supported by underlying database driver).
 847:      * @throws PropelException
 848:      */
 849:     public static function doDeleteAll(PropelPDO $con = null)
 850:     {
 851:         if ($con === null) {
 852:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 853:         }
 854:         $affectedRows = 0; // initialize var to track total num of affected rows
 855:         try {
 856:             // use transaction because $criteria could contain info
 857:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 858:             $con->beginTransaction();
 859:             $affectedRows += BasePeer::doDeleteAll(SynonymPeer::TABLE_NAME, $con, SynonymPeer::DATABASE_NAME);
 860:             // Because this db requires some delete cascade/set null emulation, we have to
 861:             // clear the cached instance *after* the emulation has happened (since
 862:             // instances get re-added by the select statement contained therein).
 863:             SynonymPeer::clearInstancePool();
 864:             SynonymPeer::clearRelatedInstancePool();
 865:             $con->commit();
 866: 
 867:             return $affectedRows;
 868:         } catch (PropelException $e) {
 869:             $con->rollBack();
 870:             throw $e;
 871:         }
 872:     }
 873: 
 874:     /**
 875:      * Performs a DELETE on the database, given a Synonym or Criteria object OR a primary key value.
 876:      *
 877:      * @param      mixed $values Criteria or Synonym object or primary key or array of primary keys
 878:      *              which is used to create the DELETE statement
 879:      * @param      PropelPDO $con the connection to use
 880:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
 881:      *              if supported by native driver or if emulated using Propel.
 882:      * @throws PropelException Any exceptions caught during processing will be
 883:      *       rethrown wrapped into a PropelException.
 884:      */
 885:      public static function doDelete($values, PropelPDO $con = null)
 886:      {
 887:         if ($con === null) {
 888:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 889:         }
 890: 
 891:         if ($values instanceof Criteria) {
 892:             // invalidate the cache for all objects of this type, since we have no
 893:             // way of knowing (without running a query) what objects should be invalidated
 894:             // from the cache based on this Criteria.
 895:             SynonymPeer::clearInstancePool();
 896:             // rename for clarity
 897:             $criteria = clone $values;
 898:         } elseif ($values instanceof Synonym) { // it's a model object
 899:             // invalidate the cache for this single object
 900:             SynonymPeer::removeInstanceFromPool($values);
 901:             // create criteria based on pk values
 902:             $criteria = $values->buildPkeyCriteria();
 903:         } else { // it's a primary key, or an array of pks
 904:             $criteria = new Criteria(SynonymPeer::DATABASE_NAME);
 905:             $criteria->add(SynonymPeer::SYNONYM_ID, (array) $values, Criteria::IN);
 906:             // invalidate the cache for this object(s)
 907:             foreach ((array) $values as $singleval) {
 908:                 SynonymPeer::removeInstanceFromPool($singleval);
 909:             }
 910:         }
 911: 
 912:         // Set the correct dbName
 913:         $criteria->setDbName(SynonymPeer::DATABASE_NAME);
 914: 
 915:         $affectedRows = 0; // initialize var to track total num of affected rows
 916: 
 917:         try {
 918:             // use transaction because $criteria could contain info
 919:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 920:             $con->beginTransaction();
 921: 
 922:             $affectedRows += BasePeer::doDelete($criteria, $con);
 923:             SynonymPeer::clearRelatedInstancePool();
 924:             $con->commit();
 925: 
 926:             return $affectedRows;
 927:         } catch (PropelException $e) {
 928:             $con->rollBack();
 929:             throw $e;
 930:         }
 931:     }
 932: 
 933:     /**
 934:      * Validates all modified columns of given Synonym object.
 935:      * If parameter $columns is either a single column name or an array of column names
 936:      * than only those columns are validated.
 937:      *
 938:      * NOTICE: This does not apply to primary or foreign keys for now.
 939:      *
 940:      * @param      Synonym $obj The object to validate.
 941:      * @param      mixed $cols Column name or array of column names.
 942:      *
 943:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
 944:      */
 945:     public static function doValidate($obj, $cols = null)
 946:     {
 947:         $columns = array();
 948: 
 949:         if ($cols) {
 950:             $dbMap = Propel::getDatabaseMap(SynonymPeer::DATABASE_NAME);
 951:             $tableMap = $dbMap->getTable(SynonymPeer::TABLE_NAME);
 952: 
 953:             if (! is_array($cols)) {
 954:                 $cols = array($cols);
 955:             }
 956: 
 957:             foreach ($cols as $colName) {
 958:                 if ($tableMap->hasColumn($colName)) {
 959:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
 960:                     $columns[$colName] = $obj->$get();
 961:                 }
 962:             }
 963:         } else {
 964: 
 965:         }
 966: 
 967:         return BasePeer::doValidate(SynonymPeer::DATABASE_NAME, SynonymPeer::TABLE_NAME, $columns);
 968:     }
 969: 
 970:     /**
 971:      * Retrieve a single object by pkey.
 972:      *
 973:      * @param      int $pk the primary key.
 974:      * @param      PropelPDO $con the connection to use
 975:      * @return Synonym
 976:      */
 977:     public static function retrieveByPK($pk, PropelPDO $con = null)
 978:     {
 979: 
 980:         if (null !== ($obj = SynonymPeer::getInstanceFromPool((string) $pk))) {
 981:             return $obj;
 982:         }
 983: 
 984:         if ($con === null) {
 985:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 986:         }
 987: 
 988:         $criteria = new Criteria(SynonymPeer::DATABASE_NAME);
 989:         $criteria->add(SynonymPeer::SYNONYM_ID, $pk);
 990: 
 991:         $v = SynonymPeer::doSelect($criteria, $con);
 992: 
 993:         return !empty($v) > 0 ? $v[0] : null;
 994:     }
 995: 
 996:     /**
 997:      * Retrieve multiple objects by pkey.
 998:      *
 999:      * @param      array $pks List of primary keys
1000:      * @param      PropelPDO $con the connection to use
1001:      * @return Synonym[]
1002:      * @throws PropelException Any exceptions caught during processing will be
1003:      *       rethrown wrapped into a PropelException.
1004:      */
1005:     public static function retrieveByPKs($pks, PropelPDO $con = null)
1006:     {
1007:         if ($con === null) {
1008:             $con = Propel::getConnection(SynonymPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1009:         }
1010: 
1011:         $objs = null;
1012:         if (empty($pks)) {
1013:             $objs = array();
1014:         } else {
1015:             $criteria = new Criteria(SynonymPeer::DATABASE_NAME);
1016:             $criteria->add(SynonymPeer::SYNONYM_ID, $pks, Criteria::IN);
1017:             $objs = SynonymPeer::doSelect($criteria, $con);
1018:         }
1019: 
1020:         return $objs;
1021:     }
1022: 
1023: } // BaseSynonymPeer
1024: 
1025: // This is the static code needed to register the TableMap for this table with the main Propel class.
1026: //
1027: BaseSynonymPeer::buildTableMap();
1028: 
1029: 
tbro API documentation generated by ApiGen 2.8.0