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