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\FeatureCvtermPeer;
13: use cli_db\propel\FeatureCvtermPub;
14: use cli_db\propel\FeatureCvtermPubPeer;
15: use cli_db\propel\PubPeer;
16: use cli_db\propel\map\FeatureCvtermPubTableMap;
17:
18: /**
19: * Base static class for performing query and update operations on the 'feature_cvterm_pub' table.
20: *
21: *
22: *
23: * @package propel.generator.cli_db.om
24: */
25: abstract class BaseFeatureCvtermPubPeer
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 = 'feature_cvterm_pub';
33:
34: /** the related Propel class for this table */
35: const OM_CLASS = 'cli_db\\propel\\FeatureCvtermPub';
36:
37: /** the related TableMap class for this table */
38: const TM_CLASS = 'FeatureCvtermPubTableMap';
39:
40: /** The total number of columns. */
41: const NUM_COLUMNS = 3;
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 = 3;
48:
49: /** the column name for the feature_cvterm_pub_id field */
50: const FEATURE_CVTERM_PUB_ID = 'feature_cvterm_pub.feature_cvterm_pub_id';
51:
52: /** the column name for the feature_cvterm_id field */
53: const FEATURE_CVTERM_ID = 'feature_cvterm_pub.feature_cvterm_id';
54:
55: /** the column name for the pub_id field */
56: const PUB_ID = 'feature_cvterm_pub.pub_id';
57:
58: /** The default string format for model objects of the related table **/
59: const DEFAULT_STRING_FORMAT = 'YAML';
60:
61: /**
62: * An identiy map to hold any loaded instances of FeatureCvtermPub objects.
63: * This must be public so that other peer classes can access this when hydrating from JOIN
64: * queries.
65: * @var array FeatureCvtermPub[]
66: */
67: public static $instances = array();
68:
69:
70: /**
71: * holds an array of fieldnames
72: *
73: * first dimension keys are the type constants
74: * e.g. FeatureCvtermPubPeer::$fieldNames[FeatureCvtermPubPeer::TYPE_PHPNAME][0] = 'Id'
75: */
76: protected static $fieldNames = array (
77: BasePeer::TYPE_PHPNAME => array ('FeatureCvtermPubId', 'FeatureCvtermId', 'PubId', ),
78: BasePeer::TYPE_STUDLYPHPNAME => array ('featureCvtermPubId', 'featureCvtermId', 'pubId', ),
79: BasePeer::TYPE_COLNAME => array (FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID, FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPubPeer::PUB_ID, ),
80: BasePeer::TYPE_RAW_COLNAME => array ('FEATURE_CVTERM_PUB_ID', 'FEATURE_CVTERM_ID', 'PUB_ID', ),
81: BasePeer::TYPE_FIELDNAME => array ('feature_cvterm_pub_id', 'feature_cvterm_id', 'pub_id', ),
82: BasePeer::TYPE_NUM => array (0, 1, 2, )
83: );
84:
85: /**
86: * holds an array of keys for quick access to the fieldnames array
87: *
88: * first dimension keys are the type constants
89: * e.g. FeatureCvtermPubPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
90: */
91: protected static $fieldKeys = array (
92: BasePeer::TYPE_PHPNAME => array ('FeatureCvtermPubId' => 0, 'FeatureCvtermId' => 1, 'PubId' => 2, ),
93: BasePeer::TYPE_STUDLYPHPNAME => array ('featureCvtermPubId' => 0, 'featureCvtermId' => 1, 'pubId' => 2, ),
94: BasePeer::TYPE_COLNAME => array (FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID => 0, FeatureCvtermPubPeer::FEATURE_CVTERM_ID => 1, FeatureCvtermPubPeer::PUB_ID => 2, ),
95: BasePeer::TYPE_RAW_COLNAME => array ('FEATURE_CVTERM_PUB_ID' => 0, 'FEATURE_CVTERM_ID' => 1, 'PUB_ID' => 2, ),
96: BasePeer::TYPE_FIELDNAME => array ('feature_cvterm_pub_id' => 0, 'feature_cvterm_id' => 1, 'pub_id' => 2, ),
97: BasePeer::TYPE_NUM => array (0, 1, 2, )
98: );
99:
100: /**
101: * Translates a fieldname to another type
102: *
103: * @param string $name field name
104: * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
105: * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
106: * @param string $toType One of the class type constants
107: * @return string translated name of the field.
108: * @throws PropelException - if the specified name could not be found in the fieldname mappings.
109: */
110: public static function translateFieldName($name, $fromType, $toType)
111: {
112: $toNames = FeatureCvtermPubPeer::getFieldNames($toType);
113: $key = isset(FeatureCvtermPubPeer::$fieldKeys[$fromType][$name]) ? FeatureCvtermPubPeer::$fieldKeys[$fromType][$name] : null;
114: if ($key === null) {
115: throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureCvtermPubPeer::$fieldKeys[$fromType], true));
116: }
117:
118: return $toNames[$key];
119: }
120:
121: /**
122: * Returns an array of field names.
123: *
124: * @param string $type The type of fieldnames to return:
125: * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
126: * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
127: * @return array A list of field names
128: * @throws PropelException - if the type is not valid.
129: */
130: public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
131: {
132: if (!array_key_exists($type, FeatureCvtermPubPeer::$fieldNames)) {
133: 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.');
134: }
135:
136: return FeatureCvtermPubPeer::$fieldNames[$type];
137: }
138:
139: /**
140: * Convenience method which changes table.column to alias.column.
141: *
142: * Using this method you can maintain SQL abstraction while using column aliases.
143: * <code>
144: * $c->addAlias("alias1", TablePeer::TABLE_NAME);
145: * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
146: * </code>
147: * @param string $alias The alias for the current table.
148: * @param string $column The column name for current table. (i.e. FeatureCvtermPubPeer::COLUMN_NAME).
149: * @return string
150: */
151: public static function alias($alias, $column)
152: {
153: return str_replace(FeatureCvtermPubPeer::TABLE_NAME.'.', $alias.'.', $column);
154: }
155:
156: /**
157: * Add all the columns needed to create a new object.
158: *
159: * Note: any columns that were marked with lazyLoad="true" in the
160: * XML schema will not be added to the select list and only loaded
161: * on demand.
162: *
163: * @param Criteria $criteria object containing the columns to add.
164: * @param string $alias optional table alias
165: * @throws PropelException Any exceptions caught during processing will be
166: * rethrown wrapped into a PropelException.
167: */
168: public static function addSelectColumns(Criteria $criteria, $alias = null)
169: {
170: if (null === $alias) {
171: $criteria->addSelectColumn(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID);
172: $criteria->addSelectColumn(FeatureCvtermPubPeer::FEATURE_CVTERM_ID);
173: $criteria->addSelectColumn(FeatureCvtermPubPeer::PUB_ID);
174: } else {
175: $criteria->addSelectColumn($alias . '.feature_cvterm_pub_id');
176: $criteria->addSelectColumn($alias . '.feature_cvterm_id');
177: $criteria->addSelectColumn($alias . '.pub_id');
178: }
179: }
180:
181: /**
182: * Returns the number of rows matching criteria.
183: *
184: * @param Criteria $criteria
185: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
186: * @param PropelPDO $con
187: * @return int Number of matching rows.
188: */
189: public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
190: {
191: // we may modify criteria, so copy it first
192: $criteria = clone $criteria;
193:
194: // We need to set the primary table name, since in the case that there are no WHERE columns
195: // it will be impossible for the BasePeer::createSelectSql() method to determine which
196: // tables go into the FROM clause.
197: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
198:
199: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
200: $criteria->setDistinct();
201: }
202:
203: if (!$criteria->hasSelectClause()) {
204: FeatureCvtermPubPeer::addSelectColumns($criteria);
205: }
206:
207: $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
208: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME); // Set the correct dbName
209:
210: if ($con === null) {
211: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
212: }
213: // BasePeer returns a PDOStatement
214: $stmt = BasePeer::doCount($criteria, $con);
215:
216: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
217: $count = (int) $row[0];
218: } else {
219: $count = 0; // no rows returned; we infer that means 0 matches.
220: }
221: $stmt->closeCursor();
222:
223: return $count;
224: }
225: /**
226: * Selects one object from the DB.
227: *
228: * @param Criteria $criteria object used to create the SELECT statement.
229: * @param PropelPDO $con
230: * @return FeatureCvtermPub
231: * @throws PropelException Any exceptions caught during processing will be
232: * rethrown wrapped into a PropelException.
233: */
234: public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
235: {
236: $critcopy = clone $criteria;
237: $critcopy->setLimit(1);
238: $objects = FeatureCvtermPubPeer::doSelect($critcopy, $con);
239: if ($objects) {
240: return $objects[0];
241: }
242:
243: return null;
244: }
245: /**
246: * Selects several row from the DB.
247: *
248: * @param Criteria $criteria The Criteria object used to build the SELECT statement.
249: * @param PropelPDO $con
250: * @return array Array of selected Objects
251: * @throws PropelException Any exceptions caught during processing will be
252: * rethrown wrapped into a PropelException.
253: */
254: public static function doSelect(Criteria $criteria, PropelPDO $con = null)
255: {
256: return FeatureCvtermPubPeer::populateObjects(FeatureCvtermPubPeer::doSelectStmt($criteria, $con));
257: }
258: /**
259: * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
260: *
261: * Use this method directly if you want to work with an executed statement directly (for example
262: * to perform your own object hydration).
263: *
264: * @param Criteria $criteria The Criteria object used to build the SELECT statement.
265: * @param PropelPDO $con The connection to use
266: * @throws PropelException Any exceptions caught during processing will be
267: * rethrown wrapped into a PropelException.
268: * @return PDOStatement The executed PDOStatement object.
269: * @see BasePeer::doSelect()
270: */
271: public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
272: {
273: if ($con === null) {
274: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
275: }
276:
277: if (!$criteria->hasSelectClause()) {
278: $criteria = clone $criteria;
279: FeatureCvtermPubPeer::addSelectColumns($criteria);
280: }
281:
282: // Set the correct dbName
283: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
284:
285: // BasePeer returns a PDOStatement
286: return BasePeer::doSelect($criteria, $con);
287: }
288: /**
289: * Adds an object to the instance pool.
290: *
291: * Propel keeps cached copies of objects in an instance pool when they are retrieved
292: * from the database. In some cases -- especially when you override doSelect*()
293: * methods in your stub classes -- you may need to explicitly add objects
294: * to the cache in order to ensure that the same objects are always returned by doSelect*()
295: * and retrieveByPK*() calls.
296: *
297: * @param FeatureCvtermPub $obj A FeatureCvtermPub object.
298: * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
299: */
300: public static function addInstanceToPool($obj, $key = null)
301: {
302: if (Propel::isInstancePoolingEnabled()) {
303: if ($key === null) {
304: $key = (string) $obj->getFeatureCvtermPubId();
305: } // if key === null
306: FeatureCvtermPubPeer::$instances[$key] = $obj;
307: }
308: }
309:
310: /**
311: * Removes an object from the instance pool.
312: *
313: * Propel keeps cached copies of objects in an instance pool when they are retrieved
314: * from the database. In some cases -- especially when you override doDelete
315: * methods in your stub classes -- you may need to explicitly remove objects
316: * from the cache in order to prevent returning objects that no longer exist.
317: *
318: * @param mixed $value A FeatureCvtermPub object or a primary key value.
319: *
320: * @return void
321: * @throws PropelException - if the value is invalid.
322: */
323: public static function removeInstanceFromPool($value)
324: {
325: if (Propel::isInstancePoolingEnabled() && $value !== null) {
326: if (is_object($value) && $value instanceof FeatureCvtermPub) {
327: $key = (string) $value->getFeatureCvtermPubId();
328: } elseif (is_scalar($value)) {
329: // assume we've been passed a primary key
330: $key = (string) $value;
331: } else {
332: $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FeatureCvtermPub object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
333: throw $e;
334: }
335:
336: unset(FeatureCvtermPubPeer::$instances[$key]);
337: }
338: } // removeInstanceFromPool()
339:
340: /**
341: * 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.
342: *
343: * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
344: * a multi-column primary key, a serialize()d version of the primary key will be returned.
345: *
346: * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
347: * @return FeatureCvtermPub Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
348: * @see getPrimaryKeyHash()
349: */
350: public static function getInstanceFromPool($key)
351: {
352: if (Propel::isInstancePoolingEnabled()) {
353: if (isset(FeatureCvtermPubPeer::$instances[$key])) {
354: return FeatureCvtermPubPeer::$instances[$key];
355: }
356: }
357:
358: return null; // just to be explicit
359: }
360:
361: /**
362: * Clear the instance pool.
363: *
364: * @return void
365: */
366: public static function clearInstancePool($and_clear_all_references = false)
367: {
368: if ($and_clear_all_references)
369: {
370: foreach (FeatureCvtermPubPeer::$instances as $instance)
371: {
372: $instance->clearAllReferences(true);
373: }
374: }
375: FeatureCvtermPubPeer::$instances = array();
376: }
377:
378: /**
379: * Method to invalidate the instance pool of all tables related to feature_cvterm_pub
380: * by a foreign key with ON DELETE CASCADE
381: */
382: public static function clearRelatedInstancePool()
383: {
384: }
385:
386: /**
387: * 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.
388: *
389: * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
390: * a multi-column primary key, a serialize()d version of the primary key will be returned.
391: *
392: * @param array $row PropelPDO resultset row.
393: * @param int $startcol The 0-based offset for reading from the resultset row.
394: * @return string A string version of PK or null if the components of primary key in result array are all null.
395: */
396: public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
397: {
398: // If the PK cannot be derived from the row, return null.
399: if ($row[$startcol] === null) {
400: return null;
401: }
402:
403: return (string) $row[$startcol];
404: }
405:
406: /**
407: * Retrieves the primary key from the DB resultset row
408: * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
409: * a multi-column primary key, an array of the primary key columns will be returned.
410: *
411: * @param array $row PropelPDO resultset row.
412: * @param int $startcol The 0-based offset for reading from the resultset row.
413: * @return mixed The primary key of the row
414: */
415: public static function getPrimaryKeyFromRow($row, $startcol = 0)
416: {
417:
418: return (int) $row[$startcol];
419: }
420:
421: /**
422: * The returned array will contain objects of the default type or
423: * objects that inherit from the default.
424: *
425: * @throws PropelException Any exceptions caught during processing will be
426: * rethrown wrapped into a PropelException.
427: */
428: public static function populateObjects(PDOStatement $stmt)
429: {
430: $results = array();
431:
432: // set the class once to avoid overhead in the loop
433: $cls = FeatureCvtermPubPeer::getOMClass();
434: // populate the object(s)
435: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
436: $key = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
437: if (null !== ($obj = FeatureCvtermPubPeer::getInstanceFromPool($key))) {
438: // We no longer rehydrate the object, since this can cause data loss.
439: // See http://www.propelorm.org/ticket/509
440: // $obj->hydrate($row, 0, true); // rehydrate
441: $results[] = $obj;
442: } else {
443: $obj = new $cls();
444: $obj->hydrate($row);
445: $results[] = $obj;
446: FeatureCvtermPubPeer::addInstanceToPool($obj, $key);
447: } // if key exists
448: }
449: $stmt->closeCursor();
450:
451: return $results;
452: }
453: /**
454: * Populates an object of the default type or an object that inherit from the default.
455: *
456: * @param array $row PropelPDO resultset row.
457: * @param int $startcol The 0-based offset for reading from the resultset row.
458: * @throws PropelException Any exceptions caught during processing will be
459: * rethrown wrapped into a PropelException.
460: * @return array (FeatureCvtermPub object, last column rank)
461: */
462: public static function populateObject($row, $startcol = 0)
463: {
464: $key = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, $startcol);
465: if (null !== ($obj = FeatureCvtermPubPeer::getInstanceFromPool($key))) {
466: // We no longer rehydrate the object, since this can cause data loss.
467: // See http://www.propelorm.org/ticket/509
468: // $obj->hydrate($row, $startcol, true); // rehydrate
469: $col = $startcol + FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
470: } else {
471: $cls = FeatureCvtermPubPeer::OM_CLASS;
472: $obj = new $cls();
473: $col = $obj->hydrate($row, $startcol);
474: FeatureCvtermPubPeer::addInstanceToPool($obj, $key);
475: }
476:
477: return array($obj, $col);
478: }
479:
480:
481: /**
482: * Returns the number of rows matching criteria, joining the related FeatureCvterm table
483: *
484: * @param Criteria $criteria
485: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
486: * @param PropelPDO $con
487: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
488: * @return int Number of matching rows.
489: */
490: public static function doCountJoinFeatureCvterm(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
491: {
492: // we're going to modify criteria, so copy it first
493: $criteria = clone $criteria;
494:
495: // We need to set the primary table name, since in the case that there are no WHERE columns
496: // it will be impossible for the BasePeer::createSelectSql() method to determine which
497: // tables go into the FROM clause.
498: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
499:
500: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
501: $criteria->setDistinct();
502: }
503:
504: if (!$criteria->hasSelectClause()) {
505: FeatureCvtermPubPeer::addSelectColumns($criteria);
506: }
507:
508: $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
509:
510: // Set the correct dbName
511: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
512:
513: if ($con === null) {
514: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
515: }
516:
517: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
518:
519: $stmt = BasePeer::doCount($criteria, $con);
520:
521: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
522: $count = (int) $row[0];
523: } else {
524: $count = 0; // no rows returned; we infer that means 0 matches.
525: }
526: $stmt->closeCursor();
527:
528: return $count;
529: }
530:
531:
532: /**
533: * Returns the number of rows matching criteria, joining the related Pub table
534: *
535: * @param Criteria $criteria
536: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
537: * @param PropelPDO $con
538: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
539: * @return int Number of matching rows.
540: */
541: public static function doCountJoinPub(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
542: {
543: // we're going to modify criteria, so copy it first
544: $criteria = clone $criteria;
545:
546: // We need to set the primary table name, since in the case that there are no WHERE columns
547: // it will be impossible for the BasePeer::createSelectSql() method to determine which
548: // tables go into the FROM clause.
549: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
550:
551: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
552: $criteria->setDistinct();
553: }
554:
555: if (!$criteria->hasSelectClause()) {
556: FeatureCvtermPubPeer::addSelectColumns($criteria);
557: }
558:
559: $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
560:
561: // Set the correct dbName
562: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
563:
564: if ($con === null) {
565: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
566: }
567:
568: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
569:
570: $stmt = BasePeer::doCount($criteria, $con);
571:
572: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
573: $count = (int) $row[0];
574: } else {
575: $count = 0; // no rows returned; we infer that means 0 matches.
576: }
577: $stmt->closeCursor();
578:
579: return $count;
580: }
581:
582:
583: /**
584: * Selects a collection of FeatureCvtermPub objects pre-filled with their FeatureCvterm objects.
585: * @param Criteria $criteria
586: * @param PropelPDO $con
587: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
588: * @return array Array of FeatureCvtermPub objects.
589: * @throws PropelException Any exceptions caught during processing will be
590: * rethrown wrapped into a PropelException.
591: */
592: public static function doSelectJoinFeatureCvterm(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
593: {
594: $criteria = clone $criteria;
595:
596: // Set the correct dbName if it has not been overridden
597: if ($criteria->getDbName() == Propel::getDefaultDB()) {
598: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
599: }
600:
601: FeatureCvtermPubPeer::addSelectColumns($criteria);
602: $startcol = FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
603: FeatureCvtermPeer::addSelectColumns($criteria);
604:
605: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
606:
607: $stmt = BasePeer::doSelect($criteria, $con);
608: $results = array();
609:
610: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
611: $key1 = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
612: if (null !== ($obj1 = FeatureCvtermPubPeer::getInstanceFromPool($key1))) {
613: // We no longer rehydrate the object, since this can cause data loss.
614: // See http://www.propelorm.org/ticket/509
615: // $obj1->hydrate($row, 0, true); // rehydrate
616: } else {
617:
618: $cls = FeatureCvtermPubPeer::getOMClass();
619:
620: $obj1 = new $cls();
621: $obj1->hydrate($row);
622: FeatureCvtermPubPeer::addInstanceToPool($obj1, $key1);
623: } // if $obj1 already loaded
624:
625: $key2 = FeatureCvtermPeer::getPrimaryKeyHashFromRow($row, $startcol);
626: if ($key2 !== null) {
627: $obj2 = FeatureCvtermPeer::getInstanceFromPool($key2);
628: if (!$obj2) {
629:
630: $cls = FeatureCvtermPeer::getOMClass();
631:
632: $obj2 = new $cls();
633: $obj2->hydrate($row, $startcol);
634: FeatureCvtermPeer::addInstanceToPool($obj2, $key2);
635: } // if obj2 already loaded
636:
637: // Add the $obj1 (FeatureCvtermPub) to $obj2 (FeatureCvterm)
638: $obj2->addFeatureCvtermPub($obj1);
639:
640: } // if joined row was not null
641:
642: $results[] = $obj1;
643: }
644: $stmt->closeCursor();
645:
646: return $results;
647: }
648:
649:
650: /**
651: * Selects a collection of FeatureCvtermPub objects pre-filled with their Pub objects.
652: * @param Criteria $criteria
653: * @param PropelPDO $con
654: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
655: * @return array Array of FeatureCvtermPub objects.
656: * @throws PropelException Any exceptions caught during processing will be
657: * rethrown wrapped into a PropelException.
658: */
659: public static function doSelectJoinPub(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
660: {
661: $criteria = clone $criteria;
662:
663: // Set the correct dbName if it has not been overridden
664: if ($criteria->getDbName() == Propel::getDefaultDB()) {
665: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
666: }
667:
668: FeatureCvtermPubPeer::addSelectColumns($criteria);
669: $startcol = FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
670: PubPeer::addSelectColumns($criteria);
671:
672: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
673:
674: $stmt = BasePeer::doSelect($criteria, $con);
675: $results = array();
676:
677: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
678: $key1 = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
679: if (null !== ($obj1 = FeatureCvtermPubPeer::getInstanceFromPool($key1))) {
680: // We no longer rehydrate the object, since this can cause data loss.
681: // See http://www.propelorm.org/ticket/509
682: // $obj1->hydrate($row, 0, true); // rehydrate
683: } else {
684:
685: $cls = FeatureCvtermPubPeer::getOMClass();
686:
687: $obj1 = new $cls();
688: $obj1->hydrate($row);
689: FeatureCvtermPubPeer::addInstanceToPool($obj1, $key1);
690: } // if $obj1 already loaded
691:
692: $key2 = PubPeer::getPrimaryKeyHashFromRow($row, $startcol);
693: if ($key2 !== null) {
694: $obj2 = PubPeer::getInstanceFromPool($key2);
695: if (!$obj2) {
696:
697: $cls = PubPeer::getOMClass();
698:
699: $obj2 = new $cls();
700: $obj2->hydrate($row, $startcol);
701: PubPeer::addInstanceToPool($obj2, $key2);
702: } // if obj2 already loaded
703:
704: // Add the $obj1 (FeatureCvtermPub) to $obj2 (Pub)
705: $obj2->addFeatureCvtermPub($obj1);
706:
707: } // if joined row was not null
708:
709: $results[] = $obj1;
710: }
711: $stmt->closeCursor();
712:
713: return $results;
714: }
715:
716:
717: /**
718: * Returns the number of rows matching criteria, joining all related tables
719: *
720: * @param Criteria $criteria
721: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
722: * @param PropelPDO $con
723: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
724: * @return int Number of matching rows.
725: */
726: public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
727: {
728: // we're going to modify criteria, so copy it first
729: $criteria = clone $criteria;
730:
731: // We need to set the primary table name, since in the case that there are no WHERE columns
732: // it will be impossible for the BasePeer::createSelectSql() method to determine which
733: // tables go into the FROM clause.
734: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
735:
736: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
737: $criteria->setDistinct();
738: }
739:
740: if (!$criteria->hasSelectClause()) {
741: FeatureCvtermPubPeer::addSelectColumns($criteria);
742: }
743:
744: $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
745:
746: // Set the correct dbName
747: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
748:
749: if ($con === null) {
750: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
751: }
752:
753: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
754:
755: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
756:
757: $stmt = BasePeer::doCount($criteria, $con);
758:
759: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
760: $count = (int) $row[0];
761: } else {
762: $count = 0; // no rows returned; we infer that means 0 matches.
763: }
764: $stmt->closeCursor();
765:
766: return $count;
767: }
768:
769: /**
770: * Selects a collection of FeatureCvtermPub objects pre-filled with all related objects.
771: *
772: * @param Criteria $criteria
773: * @param PropelPDO $con
774: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
775: * @return array Array of FeatureCvtermPub objects.
776: * @throws PropelException Any exceptions caught during processing will be
777: * rethrown wrapped into a PropelException.
778: */
779: public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
780: {
781: $criteria = clone $criteria;
782:
783: // Set the correct dbName if it has not been overridden
784: if ($criteria->getDbName() == Propel::getDefaultDB()) {
785: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
786: }
787:
788: FeatureCvtermPubPeer::addSelectColumns($criteria);
789: $startcol2 = FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
790:
791: FeatureCvtermPeer::addSelectColumns($criteria);
792: $startcol3 = $startcol2 + FeatureCvtermPeer::NUM_HYDRATE_COLUMNS;
793:
794: PubPeer::addSelectColumns($criteria);
795: $startcol4 = $startcol3 + PubPeer::NUM_HYDRATE_COLUMNS;
796:
797: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
798:
799: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
800:
801: $stmt = BasePeer::doSelect($criteria, $con);
802: $results = array();
803:
804: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
805: $key1 = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
806: if (null !== ($obj1 = FeatureCvtermPubPeer::getInstanceFromPool($key1))) {
807: // We no longer rehydrate the object, since this can cause data loss.
808: // See http://www.propelorm.org/ticket/509
809: // $obj1->hydrate($row, 0, true); // rehydrate
810: } else {
811: $cls = FeatureCvtermPubPeer::getOMClass();
812:
813: $obj1 = new $cls();
814: $obj1->hydrate($row);
815: FeatureCvtermPubPeer::addInstanceToPool($obj1, $key1);
816: } // if obj1 already loaded
817:
818: // Add objects for joined FeatureCvterm rows
819:
820: $key2 = FeatureCvtermPeer::getPrimaryKeyHashFromRow($row, $startcol2);
821: if ($key2 !== null) {
822: $obj2 = FeatureCvtermPeer::getInstanceFromPool($key2);
823: if (!$obj2) {
824:
825: $cls = FeatureCvtermPeer::getOMClass();
826:
827: $obj2 = new $cls();
828: $obj2->hydrate($row, $startcol2);
829: FeatureCvtermPeer::addInstanceToPool($obj2, $key2);
830: } // if obj2 loaded
831:
832: // Add the $obj1 (FeatureCvtermPub) to the collection in $obj2 (FeatureCvterm)
833: $obj2->addFeatureCvtermPub($obj1);
834: } // if joined row not null
835:
836: // Add objects for joined Pub rows
837:
838: $key3 = PubPeer::getPrimaryKeyHashFromRow($row, $startcol3);
839: if ($key3 !== null) {
840: $obj3 = PubPeer::getInstanceFromPool($key3);
841: if (!$obj3) {
842:
843: $cls = PubPeer::getOMClass();
844:
845: $obj3 = new $cls();
846: $obj3->hydrate($row, $startcol3);
847: PubPeer::addInstanceToPool($obj3, $key3);
848: } // if obj3 loaded
849:
850: // Add the $obj1 (FeatureCvtermPub) to the collection in $obj3 (Pub)
851: $obj3->addFeatureCvtermPub($obj1);
852: } // if joined row not null
853:
854: $results[] = $obj1;
855: }
856: $stmt->closeCursor();
857:
858: return $results;
859: }
860:
861:
862: /**
863: * Returns the number of rows matching criteria, joining the related FeatureCvterm table
864: *
865: * @param Criteria $criteria
866: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
867: * @param PropelPDO $con
868: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
869: * @return int Number of matching rows.
870: */
871: public static function doCountJoinAllExceptFeatureCvterm(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
872: {
873: // we're going to modify criteria, so copy it first
874: $criteria = clone $criteria;
875:
876: // We need to set the primary table name, since in the case that there are no WHERE columns
877: // it will be impossible for the BasePeer::createSelectSql() method to determine which
878: // tables go into the FROM clause.
879: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
880:
881: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
882: $criteria->setDistinct();
883: }
884:
885: if (!$criteria->hasSelectClause()) {
886: FeatureCvtermPubPeer::addSelectColumns($criteria);
887: }
888:
889: $criteria->clearOrderByColumns(); // ORDER BY should not affect count
890:
891: // Set the correct dbName
892: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
893:
894: if ($con === null) {
895: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
896: }
897:
898: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
899:
900: $stmt = BasePeer::doCount($criteria, $con);
901:
902: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
903: $count = (int) $row[0];
904: } else {
905: $count = 0; // no rows returned; we infer that means 0 matches.
906: }
907: $stmt->closeCursor();
908:
909: return $count;
910: }
911:
912:
913: /**
914: * Returns the number of rows matching criteria, joining the related Pub table
915: *
916: * @param Criteria $criteria
917: * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
918: * @param PropelPDO $con
919: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
920: * @return int Number of matching rows.
921: */
922: public static function doCountJoinAllExceptPub(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
923: {
924: // we're going to modify criteria, so copy it first
925: $criteria = clone $criteria;
926:
927: // We need to set the primary table name, since in the case that there are no WHERE columns
928: // it will be impossible for the BasePeer::createSelectSql() method to determine which
929: // tables go into the FROM clause.
930: $criteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
931:
932: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
933: $criteria->setDistinct();
934: }
935:
936: if (!$criteria->hasSelectClause()) {
937: FeatureCvtermPubPeer::addSelectColumns($criteria);
938: }
939:
940: $criteria->clearOrderByColumns(); // ORDER BY should not affect count
941:
942: // Set the correct dbName
943: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
944:
945: if ($con === null) {
946: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
947: }
948:
949: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
950:
951: $stmt = BasePeer::doCount($criteria, $con);
952:
953: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
954: $count = (int) $row[0];
955: } else {
956: $count = 0; // no rows returned; we infer that means 0 matches.
957: }
958: $stmt->closeCursor();
959:
960: return $count;
961: }
962:
963:
964: /**
965: * Selects a collection of FeatureCvtermPub objects pre-filled with all related objects except FeatureCvterm.
966: *
967: * @param Criteria $criteria
968: * @param PropelPDO $con
969: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
970: * @return array Array of FeatureCvtermPub objects.
971: * @throws PropelException Any exceptions caught during processing will be
972: * rethrown wrapped into a PropelException.
973: */
974: public static function doSelectJoinAllExceptFeatureCvterm(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
975: {
976: $criteria = clone $criteria;
977:
978: // Set the correct dbName if it has not been overridden
979: // $criteria->getDbName() will return the same object if not set to another value
980: // so == check is okay and faster
981: if ($criteria->getDbName() == Propel::getDefaultDB()) {
982: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
983: }
984:
985: FeatureCvtermPubPeer::addSelectColumns($criteria);
986: $startcol2 = FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
987:
988: PubPeer::addSelectColumns($criteria);
989: $startcol3 = $startcol2 + PubPeer::NUM_HYDRATE_COLUMNS;
990:
991: $criteria->addJoin(FeatureCvtermPubPeer::PUB_ID, PubPeer::PUB_ID, $join_behavior);
992:
993:
994: $stmt = BasePeer::doSelect($criteria, $con);
995: $results = array();
996:
997: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
998: $key1 = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
999: if (null !== ($obj1 = FeatureCvtermPubPeer::getInstanceFromPool($key1))) {
1000: // We no longer rehydrate the object, since this can cause data loss.
1001: // See http://www.propelorm.org/ticket/509
1002: // $obj1->hydrate($row, 0, true); // rehydrate
1003: } else {
1004: $cls = FeatureCvtermPubPeer::getOMClass();
1005:
1006: $obj1 = new $cls();
1007: $obj1->hydrate($row);
1008: FeatureCvtermPubPeer::addInstanceToPool($obj1, $key1);
1009: } // if obj1 already loaded
1010:
1011: // Add objects for joined Pub rows
1012:
1013: $key2 = PubPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1014: if ($key2 !== null) {
1015: $obj2 = PubPeer::getInstanceFromPool($key2);
1016: if (!$obj2) {
1017:
1018: $cls = PubPeer::getOMClass();
1019:
1020: $obj2 = new $cls();
1021: $obj2->hydrate($row, $startcol2);
1022: PubPeer::addInstanceToPool($obj2, $key2);
1023: } // if $obj2 already loaded
1024:
1025: // Add the $obj1 (FeatureCvtermPub) to the collection in $obj2 (Pub)
1026: $obj2->addFeatureCvtermPub($obj1);
1027:
1028: } // if joined row is not null
1029:
1030: $results[] = $obj1;
1031: }
1032: $stmt->closeCursor();
1033:
1034: return $results;
1035: }
1036:
1037:
1038: /**
1039: * Selects a collection of FeatureCvtermPub objects pre-filled with all related objects except Pub.
1040: *
1041: * @param Criteria $criteria
1042: * @param PropelPDO $con
1043: * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1044: * @return array Array of FeatureCvtermPub objects.
1045: * @throws PropelException Any exceptions caught during processing will be
1046: * rethrown wrapped into a PropelException.
1047: */
1048: public static function doSelectJoinAllExceptPub(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1049: {
1050: $criteria = clone $criteria;
1051:
1052: // Set the correct dbName if it has not been overridden
1053: // $criteria->getDbName() will return the same object if not set to another value
1054: // so == check is okay and faster
1055: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1056: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
1057: }
1058:
1059: FeatureCvtermPubPeer::addSelectColumns($criteria);
1060: $startcol2 = FeatureCvtermPubPeer::NUM_HYDRATE_COLUMNS;
1061:
1062: FeatureCvtermPeer::addSelectColumns($criteria);
1063: $startcol3 = $startcol2 + FeatureCvtermPeer::NUM_HYDRATE_COLUMNS;
1064:
1065: $criteria->addJoin(FeatureCvtermPubPeer::FEATURE_CVTERM_ID, FeatureCvtermPeer::FEATURE_CVTERM_ID, $join_behavior);
1066:
1067:
1068: $stmt = BasePeer::doSelect($criteria, $con);
1069: $results = array();
1070:
1071: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1072: $key1 = FeatureCvtermPubPeer::getPrimaryKeyHashFromRow($row, 0);
1073: if (null !== ($obj1 = FeatureCvtermPubPeer::getInstanceFromPool($key1))) {
1074: // We no longer rehydrate the object, since this can cause data loss.
1075: // See http://www.propelorm.org/ticket/509
1076: // $obj1->hydrate($row, 0, true); // rehydrate
1077: } else {
1078: $cls = FeatureCvtermPubPeer::getOMClass();
1079:
1080: $obj1 = new $cls();
1081: $obj1->hydrate($row);
1082: FeatureCvtermPubPeer::addInstanceToPool($obj1, $key1);
1083: } // if obj1 already loaded
1084:
1085: // Add objects for joined FeatureCvterm rows
1086:
1087: $key2 = FeatureCvtermPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1088: if ($key2 !== null) {
1089: $obj2 = FeatureCvtermPeer::getInstanceFromPool($key2);
1090: if (!$obj2) {
1091:
1092: $cls = FeatureCvtermPeer::getOMClass();
1093:
1094: $obj2 = new $cls();
1095: $obj2->hydrate($row, $startcol2);
1096: FeatureCvtermPeer::addInstanceToPool($obj2, $key2);
1097: } // if $obj2 already loaded
1098:
1099: // Add the $obj1 (FeatureCvtermPub) to the collection in $obj2 (FeatureCvterm)
1100: $obj2->addFeatureCvtermPub($obj1);
1101:
1102: } // if joined row is not null
1103:
1104: $results[] = $obj1;
1105: }
1106: $stmt->closeCursor();
1107:
1108: return $results;
1109: }
1110:
1111: /**
1112: * Returns the TableMap related to this peer.
1113: * This method is not needed for general use but a specific application could have a need.
1114: * @return TableMap
1115: * @throws PropelException Any exceptions caught during processing will be
1116: * rethrown wrapped into a PropelException.
1117: */
1118: public static function getTableMap()
1119: {
1120: return Propel::getDatabaseMap(FeatureCvtermPubPeer::DATABASE_NAME)->getTable(FeatureCvtermPubPeer::TABLE_NAME);
1121: }
1122:
1123: /**
1124: * Add a TableMap instance to the database for this peer class.
1125: */
1126: public static function buildTableMap()
1127: {
1128: $dbMap = Propel::getDatabaseMap(BaseFeatureCvtermPubPeer::DATABASE_NAME);
1129: if (!$dbMap->hasTable(BaseFeatureCvtermPubPeer::TABLE_NAME)) {
1130: $dbMap->addTableObject(new FeatureCvtermPubTableMap());
1131: }
1132: }
1133:
1134: /**
1135: * The class that the Peer will make instances of.
1136: *
1137: *
1138: * @return string ClassName
1139: */
1140: public static function getOMClass($row = 0, $colnum = 0)
1141: {
1142: return FeatureCvtermPubPeer::OM_CLASS;
1143: }
1144:
1145: /**
1146: * Performs an INSERT on the database, given a FeatureCvtermPub or Criteria object.
1147: *
1148: * @param mixed $values Criteria or FeatureCvtermPub object containing data that is used to create the INSERT statement.
1149: * @param PropelPDO $con the PropelPDO connection to use
1150: * @return mixed The new primary key.
1151: * @throws PropelException Any exceptions caught during processing will be
1152: * rethrown wrapped into a PropelException.
1153: */
1154: public static function doInsert($values, PropelPDO $con = null)
1155: {
1156: if ($con === null) {
1157: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1158: }
1159:
1160: if ($values instanceof Criteria) {
1161: $criteria = clone $values; // rename for clarity
1162: } else {
1163: $criteria = $values->buildCriteria(); // build Criteria from FeatureCvtermPub object
1164: }
1165:
1166: if ($criteria->containsKey(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID) && $criteria->keyContainsValue(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID) ) {
1167: throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID.')');
1168: }
1169:
1170:
1171: // Set the correct dbName
1172: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
1173:
1174: try {
1175: // use transaction because $criteria could contain info
1176: // for more than one table (I guess, conceivably)
1177: $con->beginTransaction();
1178: $pk = BasePeer::doInsert($criteria, $con);
1179: $con->commit();
1180: } catch (PropelException $e) {
1181: $con->rollBack();
1182: throw $e;
1183: }
1184:
1185: return $pk;
1186: }
1187:
1188: /**
1189: * Performs an UPDATE on the database, given a FeatureCvtermPub or Criteria object.
1190: *
1191: * @param mixed $values Criteria or FeatureCvtermPub object containing data that is used to create the UPDATE statement.
1192: * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
1193: * @return int The number of affected rows (if supported by underlying database driver).
1194: * @throws PropelException Any exceptions caught during processing will be
1195: * rethrown wrapped into a PropelException.
1196: */
1197: public static function doUpdate($values, PropelPDO $con = null)
1198: {
1199: if ($con === null) {
1200: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1201: }
1202:
1203: $selectCriteria = new Criteria(FeatureCvtermPubPeer::DATABASE_NAME);
1204:
1205: if ($values instanceof Criteria) {
1206: $criteria = clone $values; // rename for clarity
1207:
1208: $comparison = $criteria->getComparison(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID);
1209: $value = $criteria->remove(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID);
1210: if ($value) {
1211: $selectCriteria->add(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID, $value, $comparison);
1212: } else {
1213: $selectCriteria->setPrimaryTableName(FeatureCvtermPubPeer::TABLE_NAME);
1214: }
1215:
1216: } else { // $values is FeatureCvtermPub object
1217: $criteria = $values->buildCriteria(); // gets full criteria
1218: $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
1219: }
1220:
1221: // set the correct dbName
1222: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
1223:
1224: return BasePeer::doUpdate($selectCriteria, $criteria, $con);
1225: }
1226:
1227: /**
1228: * Deletes all rows from the feature_cvterm_pub table.
1229: *
1230: * @param PropelPDO $con the connection to use
1231: * @return int The number of affected rows (if supported by underlying database driver).
1232: * @throws PropelException
1233: */
1234: public static function doDeleteAll(PropelPDO $con = null)
1235: {
1236: if ($con === null) {
1237: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1238: }
1239: $affectedRows = 0; // initialize var to track total num of affected rows
1240: try {
1241: // use transaction because $criteria could contain info
1242: // for more than one table or we could emulating ON DELETE CASCADE, etc.
1243: $con->beginTransaction();
1244: $affectedRows += BasePeer::doDeleteAll(FeatureCvtermPubPeer::TABLE_NAME, $con, FeatureCvtermPubPeer::DATABASE_NAME);
1245: // Because this db requires some delete cascade/set null emulation, we have to
1246: // clear the cached instance *after* the emulation has happened (since
1247: // instances get re-added by the select statement contained therein).
1248: FeatureCvtermPubPeer::clearInstancePool();
1249: FeatureCvtermPubPeer::clearRelatedInstancePool();
1250: $con->commit();
1251:
1252: return $affectedRows;
1253: } catch (PropelException $e) {
1254: $con->rollBack();
1255: throw $e;
1256: }
1257: }
1258:
1259: /**
1260: * Performs a DELETE on the database, given a FeatureCvtermPub or Criteria object OR a primary key value.
1261: *
1262: * @param mixed $values Criteria or FeatureCvtermPub object or primary key or array of primary keys
1263: * which is used to create the DELETE statement
1264: * @param PropelPDO $con the connection to use
1265: * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
1266: * if supported by native driver or if emulated using Propel.
1267: * @throws PropelException Any exceptions caught during processing will be
1268: * rethrown wrapped into a PropelException.
1269: */
1270: public static function doDelete($values, PropelPDO $con = null)
1271: {
1272: if ($con === null) {
1273: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1274: }
1275:
1276: if ($values instanceof Criteria) {
1277: // invalidate the cache for all objects of this type, since we have no
1278: // way of knowing (without running a query) what objects should be invalidated
1279: // from the cache based on this Criteria.
1280: FeatureCvtermPubPeer::clearInstancePool();
1281: // rename for clarity
1282: $criteria = clone $values;
1283: } elseif ($values instanceof FeatureCvtermPub) { // it's a model object
1284: // invalidate the cache for this single object
1285: FeatureCvtermPubPeer::removeInstanceFromPool($values);
1286: // create criteria based on pk values
1287: $criteria = $values->buildPkeyCriteria();
1288: } else { // it's a primary key, or an array of pks
1289: $criteria = new Criteria(FeatureCvtermPubPeer::DATABASE_NAME);
1290: $criteria->add(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID, (array) $values, Criteria::IN);
1291: // invalidate the cache for this object(s)
1292: foreach ((array) $values as $singleval) {
1293: FeatureCvtermPubPeer::removeInstanceFromPool($singleval);
1294: }
1295: }
1296:
1297: // Set the correct dbName
1298: $criteria->setDbName(FeatureCvtermPubPeer::DATABASE_NAME);
1299:
1300: $affectedRows = 0; // initialize var to track total num of affected rows
1301:
1302: try {
1303: // use transaction because $criteria could contain info
1304: // for more than one table or we could emulating ON DELETE CASCADE, etc.
1305: $con->beginTransaction();
1306:
1307: $affectedRows += BasePeer::doDelete($criteria, $con);
1308: FeatureCvtermPubPeer::clearRelatedInstancePool();
1309: $con->commit();
1310:
1311: return $affectedRows;
1312: } catch (PropelException $e) {
1313: $con->rollBack();
1314: throw $e;
1315: }
1316: }
1317:
1318: /**
1319: * Validates all modified columns of given FeatureCvtermPub object.
1320: * If parameter $columns is either a single column name or an array of column names
1321: * than only those columns are validated.
1322: *
1323: * NOTICE: This does not apply to primary or foreign keys for now.
1324: *
1325: * @param FeatureCvtermPub $obj The object to validate.
1326: * @param mixed $cols Column name or array of column names.
1327: *
1328: * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
1329: */
1330: public static function doValidate($obj, $cols = null)
1331: {
1332: $columns = array();
1333:
1334: if ($cols) {
1335: $dbMap = Propel::getDatabaseMap(FeatureCvtermPubPeer::DATABASE_NAME);
1336: $tableMap = $dbMap->getTable(FeatureCvtermPubPeer::TABLE_NAME);
1337:
1338: if (! is_array($cols)) {
1339: $cols = array($cols);
1340: }
1341:
1342: foreach ($cols as $colName) {
1343: if ($tableMap->hasColumn($colName)) {
1344: $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1345: $columns[$colName] = $obj->$get();
1346: }
1347: }
1348: } else {
1349:
1350: }
1351:
1352: return BasePeer::doValidate(FeatureCvtermPubPeer::DATABASE_NAME, FeatureCvtermPubPeer::TABLE_NAME, $columns);
1353: }
1354:
1355: /**
1356: * Retrieve a single object by pkey.
1357: *
1358: * @param int $pk the primary key.
1359: * @param PropelPDO $con the connection to use
1360: * @return FeatureCvtermPub
1361: */
1362: public static function retrieveByPK($pk, PropelPDO $con = null)
1363: {
1364:
1365: if (null !== ($obj = FeatureCvtermPubPeer::getInstanceFromPool((string) $pk))) {
1366: return $obj;
1367: }
1368:
1369: if ($con === null) {
1370: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1371: }
1372:
1373: $criteria = new Criteria(FeatureCvtermPubPeer::DATABASE_NAME);
1374: $criteria->add(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID, $pk);
1375:
1376: $v = FeatureCvtermPubPeer::doSelect($criteria, $con);
1377:
1378: return !empty($v) > 0 ? $v[0] : null;
1379: }
1380:
1381: /**
1382: * Retrieve multiple objects by pkey.
1383: *
1384: * @param array $pks List of primary keys
1385: * @param PropelPDO $con the connection to use
1386: * @return FeatureCvtermPub[]
1387: * @throws PropelException Any exceptions caught during processing will be
1388: * rethrown wrapped into a PropelException.
1389: */
1390: public static function retrieveByPKs($pks, PropelPDO $con = null)
1391: {
1392: if ($con === null) {
1393: $con = Propel::getConnection(FeatureCvtermPubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1394: }
1395:
1396: $objs = null;
1397: if (empty($pks)) {
1398: $objs = array();
1399: } else {
1400: $criteria = new Criteria(FeatureCvtermPubPeer::DATABASE_NAME);
1401: $criteria->add(FeatureCvtermPubPeer::FEATURE_CVTERM_PUB_ID, $pks, Criteria::IN);
1402: $objs = FeatureCvtermPubPeer::doSelect($criteria, $con);
1403: }
1404:
1405: return $objs;
1406: }
1407:
1408: } // BaseFeatureCvtermPubPeer
1409:
1410: // This is the static code needed to register the TableMap for this table with the main Propel class.
1411: //
1412: BaseFeatureCvtermPubPeer::buildTableMap();
1413:
1414: