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\BiomaterialPeer;
 13: use cli_db\propel\FeaturePeer;
 14: use cli_db\propel\Organism;
 15: use cli_db\propel\OrganismPeer;
 16: use cli_db\propel\map\OrganismTableMap;
 17: 
 18: /**
 19:  * Base static class for performing query and update operations on the 'organism' table.
 20:  *
 21:  *
 22:  *
 23:  * @package propel.generator.cli_db.om
 24:  */
 25: abstract class BaseOrganismPeer
 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 = 'organism';
 33: 
 34:     /** the related Propel class for this table */
 35:     const OM_CLASS = 'cli_db\\propel\\Organism';
 36: 
 37:     /** the related TableMap class for this table */
 38:     const TM_CLASS = 'OrganismTableMap';
 39: 
 40:     /** The total number of columns. */
 41:     const NUM_COLUMNS = 6;
 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 = 6;
 48: 
 49:     /** the column name for the organism_id field */
 50:     const ORGANISM_ID = 'organism.organism_id';
 51: 
 52:     /** the column name for the abbreviation field */
 53:     const ABBREVIATION = 'organism.abbreviation';
 54: 
 55:     /** the column name for the genus field */
 56:     const GENUS = 'organism.genus';
 57: 
 58:     /** the column name for the species field */
 59:     const SPECIES = 'organism.species';
 60: 
 61:     /** the column name for the common_name field */
 62:     const COMMON_NAME = 'organism.common_name';
 63: 
 64:     /** the column name for the comment field */
 65:     const COMMENT = 'organism.comment';
 66: 
 67:     /** The default string format for model objects of the related table **/
 68:     const DEFAULT_STRING_FORMAT = 'YAML';
 69: 
 70:     /**
 71:      * An identiy map to hold any loaded instances of Organism objects.
 72:      * This must be public so that other peer classes can access this when hydrating from JOIN
 73:      * queries.
 74:      * @var        array Organism[]
 75:      */
 76:     public static $instances = array();
 77: 
 78: 
 79:     /**
 80:      * holds an array of fieldnames
 81:      *
 82:      * first dimension keys are the type constants
 83:      * e.g. OrganismPeer::$fieldNames[OrganismPeer::TYPE_PHPNAME][0] = 'Id'
 84:      */
 85:     protected static $fieldNames = array (
 86:         BasePeer::TYPE_PHPNAME => array ('OrganismId', 'Abbreviation', 'Genus', 'Species', 'CommonName', 'Comment', ),
 87:         BasePeer::TYPE_STUDLYPHPNAME => array ('organismId', 'abbreviation', 'genus', 'species', 'commonName', 'comment', ),
 88:         BasePeer::TYPE_COLNAME => array (OrganismPeer::ORGANISM_ID, OrganismPeer::ABBREVIATION, OrganismPeer::GENUS, OrganismPeer::SPECIES, OrganismPeer::COMMON_NAME, OrganismPeer::COMMENT, ),
 89:         BasePeer::TYPE_RAW_COLNAME => array ('ORGANISM_ID', 'ABBREVIATION', 'GENUS', 'SPECIES', 'COMMON_NAME', 'COMMENT', ),
 90:         BasePeer::TYPE_FIELDNAME => array ('organism_id', 'abbreviation', 'genus', 'species', 'common_name', 'comment', ),
 91:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
 92:     );
 93: 
 94:     /**
 95:      * holds an array of keys for quick access to the fieldnames array
 96:      *
 97:      * first dimension keys are the type constants
 98:      * e.g. OrganismPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 99:      */
100:     protected static $fieldKeys = array (
101:         BasePeer::TYPE_PHPNAME => array ('OrganismId' => 0, 'Abbreviation' => 1, 'Genus' => 2, 'Species' => 3, 'CommonName' => 4, 'Comment' => 5, ),
102:         BasePeer::TYPE_STUDLYPHPNAME => array ('organismId' => 0, 'abbreviation' => 1, 'genus' => 2, 'species' => 3, 'commonName' => 4, 'comment' => 5, ),
103:         BasePeer::TYPE_COLNAME => array (OrganismPeer::ORGANISM_ID => 0, OrganismPeer::ABBREVIATION => 1, OrganismPeer::GENUS => 2, OrganismPeer::SPECIES => 3, OrganismPeer::COMMON_NAME => 4, OrganismPeer::COMMENT => 5, ),
104:         BasePeer::TYPE_RAW_COLNAME => array ('ORGANISM_ID' => 0, 'ABBREVIATION' => 1, 'GENUS' => 2, 'SPECIES' => 3, 'COMMON_NAME' => 4, 'COMMENT' => 5, ),
105:         BasePeer::TYPE_FIELDNAME => array ('organism_id' => 0, 'abbreviation' => 1, 'genus' => 2, 'species' => 3, 'common_name' => 4, 'comment' => 5, ),
106:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
107:     );
108: 
109:     /**
110:      * Translates a fieldname to another type
111:      *
112:      * @param      string $name field name
113:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
114:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
115:      * @param      string $toType   One of the class type constants
116:      * @return string          translated name of the field.
117:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
118:      */
119:     public static function translateFieldName($name, $fromType, $toType)
120:     {
121:         $toNames = OrganismPeer::getFieldNames($toType);
122:         $key = isset(OrganismPeer::$fieldKeys[$fromType][$name]) ? OrganismPeer::$fieldKeys[$fromType][$name] : null;
123:         if ($key === null) {
124:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrganismPeer::$fieldKeys[$fromType], true));
125:         }
126: 
127:         return $toNames[$key];
128:     }
129: 
130:     /**
131:      * Returns an array of field names.
132:      *
133:      * @param      string $type The type of fieldnames to return:
134:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
135:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
136:      * @return array           A list of field names
137:      * @throws PropelException - if the type is not valid.
138:      */
139:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
140:     {
141:         if (!array_key_exists($type, OrganismPeer::$fieldNames)) {
142:             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.');
143:         }
144: 
145:         return OrganismPeer::$fieldNames[$type];
146:     }
147: 
148:     /**
149:      * Convenience method which changes table.column to alias.column.
150:      *
151:      * Using this method you can maintain SQL abstraction while using column aliases.
152:      * <code>
153:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
154:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
155:      * </code>
156:      * @param      string $alias The alias for the current table.
157:      * @param      string $column The column name for current table. (i.e. OrganismPeer::COLUMN_NAME).
158:      * @return string
159:      */
160:     public static function alias($alias, $column)
161:     {
162:         return str_replace(OrganismPeer::TABLE_NAME.'.', $alias.'.', $column);
163:     }
164: 
165:     /**
166:      * Add all the columns needed to create a new object.
167:      *
168:      * Note: any columns that were marked with lazyLoad="true" in the
169:      * XML schema will not be added to the select list and only loaded
170:      * on demand.
171:      *
172:      * @param      Criteria $criteria object containing the columns to add.
173:      * @param      string   $alias    optional table alias
174:      * @throws PropelException Any exceptions caught during processing will be
175:      *       rethrown wrapped into a PropelException.
176:      */
177:     public static function addSelectColumns(Criteria $criteria, $alias = null)
178:     {
179:         if (null === $alias) {
180:             $criteria->addSelectColumn(OrganismPeer::ORGANISM_ID);
181:             $criteria->addSelectColumn(OrganismPeer::ABBREVIATION);
182:             $criteria->addSelectColumn(OrganismPeer::GENUS);
183:             $criteria->addSelectColumn(OrganismPeer::SPECIES);
184:             $criteria->addSelectColumn(OrganismPeer::COMMON_NAME);
185:             $criteria->addSelectColumn(OrganismPeer::COMMENT);
186:         } else {
187:             $criteria->addSelectColumn($alias . '.organism_id');
188:             $criteria->addSelectColumn($alias . '.abbreviation');
189:             $criteria->addSelectColumn($alias . '.genus');
190:             $criteria->addSelectColumn($alias . '.species');
191:             $criteria->addSelectColumn($alias . '.common_name');
192:             $criteria->addSelectColumn($alias . '.comment');
193:         }
194:     }
195: 
196:     /**
197:      * Returns the number of rows matching criteria.
198:      *
199:      * @param      Criteria $criteria
200:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
201:      * @param      PropelPDO $con
202:      * @return int Number of matching rows.
203:      */
204:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
205:     {
206:         // we may modify criteria, so copy it first
207:         $criteria = clone $criteria;
208: 
209:         // We need to set the primary table name, since in the case that there are no WHERE columns
210:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
211:         // tables go into the FROM clause.
212:         $criteria->setPrimaryTableName(OrganismPeer::TABLE_NAME);
213: 
214:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
215:             $criteria->setDistinct();
216:         }
217: 
218:         if (!$criteria->hasSelectClause()) {
219:             OrganismPeer::addSelectColumns($criteria);
220:         }
221: 
222:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
223:         $criteria->setDbName(OrganismPeer::DATABASE_NAME); // Set the correct dbName
224: 
225:         if ($con === null) {
226:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_READ);
227:         }
228:         // BasePeer returns a PDOStatement
229:         $stmt = BasePeer::doCount($criteria, $con);
230: 
231:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
232:             $count = (int) $row[0];
233:         } else {
234:             $count = 0; // no rows returned; we infer that means 0 matches.
235:         }
236:         $stmt->closeCursor();
237: 
238:         return $count;
239:     }
240:     /**
241:      * Selects one object from the DB.
242:      *
243:      * @param      Criteria $criteria object used to create the SELECT statement.
244:      * @param      PropelPDO $con
245:      * @return                 Organism
246:      * @throws PropelException Any exceptions caught during processing will be
247:      *       rethrown wrapped into a PropelException.
248:      */
249:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
250:     {
251:         $critcopy = clone $criteria;
252:         $critcopy->setLimit(1);
253:         $objects = OrganismPeer::doSelect($critcopy, $con);
254:         if ($objects) {
255:             return $objects[0];
256:         }
257: 
258:         return null;
259:     }
260:     /**
261:      * Selects several row from the DB.
262:      *
263:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
264:      * @param      PropelPDO $con
265:      * @return array           Array of selected Objects
266:      * @throws PropelException Any exceptions caught during processing will be
267:      *       rethrown wrapped into a PropelException.
268:      */
269:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
270:     {
271:         return OrganismPeer::populateObjects(OrganismPeer::doSelectStmt($criteria, $con));
272:     }
273:     /**
274:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
275:      *
276:      * Use this method directly if you want to work with an executed statement directly (for example
277:      * to perform your own object hydration).
278:      *
279:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
280:      * @param      PropelPDO $con The connection to use
281:      * @throws PropelException Any exceptions caught during processing will be
282:      *       rethrown wrapped into a PropelException.
283:      * @return PDOStatement The executed PDOStatement object.
284:      * @see        BasePeer::doSelect()
285:      */
286:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
287:     {
288:         if ($con === null) {
289:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_READ);
290:         }
291: 
292:         if (!$criteria->hasSelectClause()) {
293:             $criteria = clone $criteria;
294:             OrganismPeer::addSelectColumns($criteria);
295:         }
296: 
297:         // Set the correct dbName
298:         $criteria->setDbName(OrganismPeer::DATABASE_NAME);
299: 
300:         // BasePeer returns a PDOStatement
301:         return BasePeer::doSelect($criteria, $con);
302:     }
303:     /**
304:      * Adds an object to the instance pool.
305:      *
306:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
307:      * from the database.  In some cases -- especially when you override doSelect*()
308:      * methods in your stub classes -- you may need to explicitly add objects
309:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
310:      * and retrieveByPK*() calls.
311:      *
312:      * @param      Organism $obj A Organism object.
313:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
314:      */
315:     public static function addInstanceToPool($obj, $key = null)
316:     {
317:         if (Propel::isInstancePoolingEnabled()) {
318:             if ($key === null) {
319:                 $key = (string) $obj->getOrganismId();
320:             } // if key === null
321:             OrganismPeer::$instances[$key] = $obj;
322:         }
323:     }
324: 
325:     /**
326:      * Removes an object from the instance pool.
327:      *
328:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
329:      * from the database.  In some cases -- especially when you override doDelete
330:      * methods in your stub classes -- you may need to explicitly remove objects
331:      * from the cache in order to prevent returning objects that no longer exist.
332:      *
333:      * @param      mixed $value A Organism object or a primary key value.
334:      *
335:      * @return void
336:      * @throws PropelException - if the value is invalid.
337:      */
338:     public static function removeInstanceFromPool($value)
339:     {
340:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
341:             if (is_object($value) && $value instanceof Organism) {
342:                 $key = (string) $value->getOrganismId();
343:             } elseif (is_scalar($value)) {
344:                 // assume we've been passed a primary key
345:                 $key = (string) $value;
346:             } else {
347:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Organism object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
348:                 throw $e;
349:             }
350: 
351:             unset(OrganismPeer::$instances[$key]);
352:         }
353:     } // removeInstanceFromPool()
354: 
355:     /**
356:      * 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.
357:      *
358:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
359:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
360:      *
361:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
362:      * @return   Organism Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
363:      * @see        getPrimaryKeyHash()
364:      */
365:     public static function getInstanceFromPool($key)
366:     {
367:         if (Propel::isInstancePoolingEnabled()) {
368:             if (isset(OrganismPeer::$instances[$key])) {
369:                 return OrganismPeer::$instances[$key];
370:             }
371:         }
372: 
373:         return null; // just to be explicit
374:     }
375: 
376:     /**
377:      * Clear the instance pool.
378:      *
379:      * @return void
380:      */
381:     public static function clearInstancePool($and_clear_all_references = false)
382:     {
383:       if ($and_clear_all_references)
384:       {
385:         foreach (OrganismPeer::$instances as $instance)
386:         {
387:           $instance->clearAllReferences(true);
388:         }
389:       }
390:         OrganismPeer::$instances = array();
391:     }
392: 
393:     /**
394:      * Method to invalidate the instance pool of all tables related to organism
395:      * by a foreign key with ON DELETE CASCADE
396:      */
397:     public static function clearRelatedInstancePool()
398:     {
399:         // Invalidate objects in BiomaterialPeer instance pool,
400:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
401:         BiomaterialPeer::clearInstancePool();
402:         // Invalidate objects in FeaturePeer instance pool,
403:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
404:         FeaturePeer::clearInstancePool();
405:     }
406: 
407:     /**
408:      * 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.
409:      *
410:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
411:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
412:      *
413:      * @param      array $row PropelPDO resultset row.
414:      * @param      int $startcol The 0-based offset for reading from the resultset row.
415:      * @return string A string version of PK or null if the components of primary key in result array are all null.
416:      */
417:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
418:     {
419:         // If the PK cannot be derived from the row, return null.
420:         if ($row[$startcol] === null) {
421:             return null;
422:         }
423: 
424:         return (string) $row[$startcol];
425:     }
426: 
427:     /**
428:      * Retrieves the primary key from the DB resultset row
429:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
430:      * a multi-column primary key, an array of the primary key columns will be returned.
431:      *
432:      * @param      array $row PropelPDO resultset row.
433:      * @param      int $startcol The 0-based offset for reading from the resultset row.
434:      * @return mixed The primary key of the row
435:      */
436:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
437:     {
438: 
439:         return (int) $row[$startcol];
440:     }
441: 
442:     /**
443:      * The returned array will contain objects of the default type or
444:      * objects that inherit from the default.
445:      *
446:      * @throws PropelException Any exceptions caught during processing will be
447:      *       rethrown wrapped into a PropelException.
448:      */
449:     public static function populateObjects(PDOStatement $stmt)
450:     {
451:         $results = array();
452: 
453:         // set the class once to avoid overhead in the loop
454:         $cls = OrganismPeer::getOMClass();
455:         // populate the object(s)
456:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
457:             $key = OrganismPeer::getPrimaryKeyHashFromRow($row, 0);
458:             if (null !== ($obj = OrganismPeer::getInstanceFromPool($key))) {
459:                 // We no longer rehydrate the object, since this can cause data loss.
460:                 // See http://www.propelorm.org/ticket/509
461:                 // $obj->hydrate($row, 0, true); // rehydrate
462:                 $results[] = $obj;
463:             } else {
464:                 $obj = new $cls();
465:                 $obj->hydrate($row);
466:                 $results[] = $obj;
467:                 OrganismPeer::addInstanceToPool($obj, $key);
468:             } // if key exists
469:         }
470:         $stmt->closeCursor();
471: 
472:         return $results;
473:     }
474:     /**
475:      * Populates an object of the default type or an object that inherit from the default.
476:      *
477:      * @param      array $row PropelPDO resultset row.
478:      * @param      int $startcol The 0-based offset for reading from the resultset row.
479:      * @throws PropelException Any exceptions caught during processing will be
480:      *       rethrown wrapped into a PropelException.
481:      * @return array (Organism object, last column rank)
482:      */
483:     public static function populateObject($row, $startcol = 0)
484:     {
485:         $key = OrganismPeer::getPrimaryKeyHashFromRow($row, $startcol);
486:         if (null !== ($obj = OrganismPeer::getInstanceFromPool($key))) {
487:             // We no longer rehydrate the object, since this can cause data loss.
488:             // See http://www.propelorm.org/ticket/509
489:             // $obj->hydrate($row, $startcol, true); // rehydrate
490:             $col = $startcol + OrganismPeer::NUM_HYDRATE_COLUMNS;
491:         } else {
492:             $cls = OrganismPeer::OM_CLASS;
493:             $obj = new $cls();
494:             $col = $obj->hydrate($row, $startcol);
495:             OrganismPeer::addInstanceToPool($obj, $key);
496:         }
497: 
498:         return array($obj, $col);
499:     }
500: 
501:     /**
502:      * Returns the TableMap related to this peer.
503:      * This method is not needed for general use but a specific application could have a need.
504:      * @return TableMap
505:      * @throws PropelException Any exceptions caught during processing will be
506:      *       rethrown wrapped into a PropelException.
507:      */
508:     public static function getTableMap()
509:     {
510:         return Propel::getDatabaseMap(OrganismPeer::DATABASE_NAME)->getTable(OrganismPeer::TABLE_NAME);
511:     }
512: 
513:     /**
514:      * Add a TableMap instance to the database for this peer class.
515:      */
516:     public static function buildTableMap()
517:     {
518:       $dbMap = Propel::getDatabaseMap(BaseOrganismPeer::DATABASE_NAME);
519:       if (!$dbMap->hasTable(BaseOrganismPeer::TABLE_NAME)) {
520:         $dbMap->addTableObject(new OrganismTableMap());
521:       }
522:     }
523: 
524:     /**
525:      * The class that the Peer will make instances of.
526:      *
527:      *
528:      * @return string ClassName
529:      */
530:     public static function getOMClass($row = 0, $colnum = 0)
531:     {
532:         return OrganismPeer::OM_CLASS;
533:     }
534: 
535:     /**
536:      * Performs an INSERT on the database, given a Organism or Criteria object.
537:      *
538:      * @param      mixed $values Criteria or Organism object containing data that is used to create the INSERT statement.
539:      * @param      PropelPDO $con the PropelPDO connection to use
540:      * @return mixed           The new primary key.
541:      * @throws PropelException Any exceptions caught during processing will be
542:      *       rethrown wrapped into a PropelException.
543:      */
544:     public static function doInsert($values, PropelPDO $con = null)
545:     {
546:         if ($con === null) {
547:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
548:         }
549: 
550:         if ($values instanceof Criteria) {
551:             $criteria = clone $values; // rename for clarity
552:         } else {
553:             $criteria = $values->buildCriteria(); // build Criteria from Organism object
554:         }
555: 
556:         if ($criteria->containsKey(OrganismPeer::ORGANISM_ID) && $criteria->keyContainsValue(OrganismPeer::ORGANISM_ID) ) {
557:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrganismPeer::ORGANISM_ID.')');
558:         }
559: 
560: 
561:         // Set the correct dbName
562:         $criteria->setDbName(OrganismPeer::DATABASE_NAME);
563: 
564:         try {
565:             // use transaction because $criteria could contain info
566:             // for more than one table (I guess, conceivably)
567:             $con->beginTransaction();
568:             $pk = BasePeer::doInsert($criteria, $con);
569:             $con->commit();
570:         } catch (PropelException $e) {
571:             $con->rollBack();
572:             throw $e;
573:         }
574: 
575:         return $pk;
576:     }
577: 
578:     /**
579:      * Performs an UPDATE on the database, given a Organism or Criteria object.
580:      *
581:      * @param      mixed $values Criteria or Organism object containing data that is used to create the UPDATE statement.
582:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
583:      * @return int             The number of affected rows (if supported by underlying database driver).
584:      * @throws PropelException Any exceptions caught during processing will be
585:      *       rethrown wrapped into a PropelException.
586:      */
587:     public static function doUpdate($values, PropelPDO $con = null)
588:     {
589:         if ($con === null) {
590:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
591:         }
592: 
593:         $selectCriteria = new Criteria(OrganismPeer::DATABASE_NAME);
594: 
595:         if ($values instanceof Criteria) {
596:             $criteria = clone $values; // rename for clarity
597: 
598:             $comparison = $criteria->getComparison(OrganismPeer::ORGANISM_ID);
599:             $value = $criteria->remove(OrganismPeer::ORGANISM_ID);
600:             if ($value) {
601:                 $selectCriteria->add(OrganismPeer::ORGANISM_ID, $value, $comparison);
602:             } else {
603:                 $selectCriteria->setPrimaryTableName(OrganismPeer::TABLE_NAME);
604:             }
605: 
606:         } else { // $values is Organism object
607:             $criteria = $values->buildCriteria(); // gets full criteria
608:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
609:         }
610: 
611:         // set the correct dbName
612:         $criteria->setDbName(OrganismPeer::DATABASE_NAME);
613: 
614:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
615:     }
616: 
617:     /**
618:      * Deletes all rows from the organism table.
619:      *
620:      * @param      PropelPDO $con the connection to use
621:      * @return int             The number of affected rows (if supported by underlying database driver).
622:      * @throws PropelException
623:      */
624:     public static function doDeleteAll(PropelPDO $con = null)
625:     {
626:         if ($con === null) {
627:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
628:         }
629:         $affectedRows = 0; // initialize var to track total num of affected rows
630:         try {
631:             // use transaction because $criteria could contain info
632:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
633:             $con->beginTransaction();
634:             $affectedRows += BasePeer::doDeleteAll(OrganismPeer::TABLE_NAME, $con, OrganismPeer::DATABASE_NAME);
635:             // Because this db requires some delete cascade/set null emulation, we have to
636:             // clear the cached instance *after* the emulation has happened (since
637:             // instances get re-added by the select statement contained therein).
638:             OrganismPeer::clearInstancePool();
639:             OrganismPeer::clearRelatedInstancePool();
640:             $con->commit();
641: 
642:             return $affectedRows;
643:         } catch (PropelException $e) {
644:             $con->rollBack();
645:             throw $e;
646:         }
647:     }
648: 
649:     /**
650:      * Performs a DELETE on the database, given a Organism or Criteria object OR a primary key value.
651:      *
652:      * @param      mixed $values Criteria or Organism object or primary key or array of primary keys
653:      *              which is used to create the DELETE statement
654:      * @param      PropelPDO $con the connection to use
655:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
656:      *              if supported by native driver or if emulated using Propel.
657:      * @throws PropelException Any exceptions caught during processing will be
658:      *       rethrown wrapped into a PropelException.
659:      */
660:      public static function doDelete($values, PropelPDO $con = null)
661:      {
662:         if ($con === null) {
663:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
664:         }
665: 
666:         if ($values instanceof Criteria) {
667:             // invalidate the cache for all objects of this type, since we have no
668:             // way of knowing (without running a query) what objects should be invalidated
669:             // from the cache based on this Criteria.
670:             OrganismPeer::clearInstancePool();
671:             // rename for clarity
672:             $criteria = clone $values;
673:         } elseif ($values instanceof Organism) { // it's a model object
674:             // invalidate the cache for this single object
675:             OrganismPeer::removeInstanceFromPool($values);
676:             // create criteria based on pk values
677:             $criteria = $values->buildPkeyCriteria();
678:         } else { // it's a primary key, or an array of pks
679:             $criteria = new Criteria(OrganismPeer::DATABASE_NAME);
680:             $criteria->add(OrganismPeer::ORGANISM_ID, (array) $values, Criteria::IN);
681:             // invalidate the cache for this object(s)
682:             foreach ((array) $values as $singleval) {
683:                 OrganismPeer::removeInstanceFromPool($singleval);
684:             }
685:         }
686: 
687:         // Set the correct dbName
688:         $criteria->setDbName(OrganismPeer::DATABASE_NAME);
689: 
690:         $affectedRows = 0; // initialize var to track total num of affected rows
691: 
692:         try {
693:             // use transaction because $criteria could contain info
694:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
695:             $con->beginTransaction();
696: 
697:             $affectedRows += BasePeer::doDelete($criteria, $con);
698:             OrganismPeer::clearRelatedInstancePool();
699:             $con->commit();
700: 
701:             return $affectedRows;
702:         } catch (PropelException $e) {
703:             $con->rollBack();
704:             throw $e;
705:         }
706:     }
707: 
708:     /**
709:      * Validates all modified columns of given Organism object.
710:      * If parameter $columns is either a single column name or an array of column names
711:      * than only those columns are validated.
712:      *
713:      * NOTICE: This does not apply to primary or foreign keys for now.
714:      *
715:      * @param      Organism $obj The object to validate.
716:      * @param      mixed $cols Column name or array of column names.
717:      *
718:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
719:      */
720:     public static function doValidate($obj, $cols = null)
721:     {
722:         $columns = array();
723: 
724:         if ($cols) {
725:             $dbMap = Propel::getDatabaseMap(OrganismPeer::DATABASE_NAME);
726:             $tableMap = $dbMap->getTable(OrganismPeer::TABLE_NAME);
727: 
728:             if (! is_array($cols)) {
729:                 $cols = array($cols);
730:             }
731: 
732:             foreach ($cols as $colName) {
733:                 if ($tableMap->hasColumn($colName)) {
734:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
735:                     $columns[$colName] = $obj->$get();
736:                 }
737:             }
738:         } else {
739: 
740:         }
741: 
742:         return BasePeer::doValidate(OrganismPeer::DATABASE_NAME, OrganismPeer::TABLE_NAME, $columns);
743:     }
744: 
745:     /**
746:      * Retrieve a single object by pkey.
747:      *
748:      * @param      int $pk the primary key.
749:      * @param      PropelPDO $con the connection to use
750:      * @return Organism
751:      */
752:     public static function retrieveByPK($pk, PropelPDO $con = null)
753:     {
754: 
755:         if (null !== ($obj = OrganismPeer::getInstanceFromPool((string) $pk))) {
756:             return $obj;
757:         }
758: 
759:         if ($con === null) {
760:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_READ);
761:         }
762: 
763:         $criteria = new Criteria(OrganismPeer::DATABASE_NAME);
764:         $criteria->add(OrganismPeer::ORGANISM_ID, $pk);
765: 
766:         $v = OrganismPeer::doSelect($criteria, $con);
767: 
768:         return !empty($v) > 0 ? $v[0] : null;
769:     }
770: 
771:     /**
772:      * Retrieve multiple objects by pkey.
773:      *
774:      * @param      array $pks List of primary keys
775:      * @param      PropelPDO $con the connection to use
776:      * @return Organism[]
777:      * @throws PropelException Any exceptions caught during processing will be
778:      *       rethrown wrapped into a PropelException.
779:      */
780:     public static function retrieveByPKs($pks, PropelPDO $con = null)
781:     {
782:         if ($con === null) {
783:             $con = Propel::getConnection(OrganismPeer::DATABASE_NAME, Propel::CONNECTION_READ);
784:         }
785: 
786:         $objs = null;
787:         if (empty($pks)) {
788:             $objs = array();
789:         } else {
790:             $criteria = new Criteria(OrganismPeer::DATABASE_NAME);
791:             $criteria->add(OrganismPeer::ORGANISM_ID, $pks, Criteria::IN);
792:             $objs = OrganismPeer::doSelect($criteria, $con);
793:         }
794: 
795:         return $objs;
796:     }
797: 
798: } // BaseOrganismPeer
799: 
800: // This is the static code needed to register the TableMap for this table with the main Propel class.
801: //
802: BaseOrganismPeer::buildTableMap();
803: 
804: 
tbro API documentation generated by ApiGen 2.8.0