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