1: <?php
2:
3: namespace cli_db\propel\om;
4:
5: use \Criteria;
6: use \Exception;
7: use \ModelCriteria;
8: use \ModelJoin;
9: use \PDO;
10: use \Propel;
11: use \PropelCollection;
12: use \PropelException;
13: use \PropelObjectCollection;
14: use \PropelPDO;
15: use cli_db\propel\Dbxref;
16: use cli_db\propel\Feature;
17: use cli_db\propel\FeatureDbxref;
18: use cli_db\propel\FeatureDbxrefPeer;
19: use cli_db\propel\FeatureDbxrefQuery;
20:
21: /**
22: * Base class that represents a query for the 'feature_dbxref' table.
23: *
24: *
25: *
26: * @method FeatureDbxrefQuery orderByFeatureDbxrefId($order = Criteria::ASC) Order by the feature_dbxref_id column
27: * @method FeatureDbxrefQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
28: * @method FeatureDbxrefQuery orderByDbxrefId($order = Criteria::ASC) Order by the dbxref_id column
29: * @method FeatureDbxrefQuery orderByIsCurrent($order = Criteria::ASC) Order by the is_current column
30: *
31: * @method FeatureDbxrefQuery groupByFeatureDbxrefId() Group by the feature_dbxref_id column
32: * @method FeatureDbxrefQuery groupByFeatureId() Group by the feature_id column
33: * @method FeatureDbxrefQuery groupByDbxrefId() Group by the dbxref_id column
34: * @method FeatureDbxrefQuery groupByIsCurrent() Group by the is_current column
35: *
36: * @method FeatureDbxrefQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
37: * @method FeatureDbxrefQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
38: * @method FeatureDbxrefQuery innerJoin($relation) Adds a INNER JOIN clause to the query
39: *
40: * @method FeatureDbxrefQuery leftJoinDbxref($relationAlias = null) Adds a LEFT JOIN clause to the query using the Dbxref relation
41: * @method FeatureDbxrefQuery rightJoinDbxref($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Dbxref relation
42: * @method FeatureDbxrefQuery innerJoinDbxref($relationAlias = null) Adds a INNER JOIN clause to the query using the Dbxref relation
43: *
44: * @method FeatureDbxrefQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation
45: * @method FeatureDbxrefQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
46: * @method FeatureDbxrefQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
47: *
48: * @method FeatureDbxref findOne(PropelPDO $con = null) Return the first FeatureDbxref matching the query
49: * @method FeatureDbxref findOneOrCreate(PropelPDO $con = null) Return the first FeatureDbxref matching the query, or a new FeatureDbxref object populated from the query conditions when no match is found
50: *
51: * @method FeatureDbxref findOneByFeatureId(int $feature_id) Return the first FeatureDbxref filtered by the feature_id column
52: * @method FeatureDbxref findOneByDbxrefId(int $dbxref_id) Return the first FeatureDbxref filtered by the dbxref_id column
53: * @method FeatureDbxref findOneByIsCurrent(boolean $is_current) Return the first FeatureDbxref filtered by the is_current column
54: *
55: * @method array findByFeatureDbxrefId(int $feature_dbxref_id) Return FeatureDbxref objects filtered by the feature_dbxref_id column
56: * @method array findByFeatureId(int $feature_id) Return FeatureDbxref objects filtered by the feature_id column
57: * @method array findByDbxrefId(int $dbxref_id) Return FeatureDbxref objects filtered by the dbxref_id column
58: * @method array findByIsCurrent(boolean $is_current) Return FeatureDbxref objects filtered by the is_current column
59: *
60: * @package propel.generator.cli_db.om
61: */
62: abstract class BaseFeatureDbxrefQuery extends ModelCriteria
63: {
64: /**
65: * Initializes internal state of BaseFeatureDbxrefQuery object.
66: *
67: * @param string $dbName The dabase name
68: * @param string $modelName The phpName of a model, e.g. 'Book'
69: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
70: */
71: public function __construct($dbName = 'cli_db', $modelName = 'cli_db\\propel\\FeatureDbxref', $modelAlias = null)
72: {
73: parent::__construct($dbName, $modelName, $modelAlias);
74: }
75:
76: /**
77: * Returns a new FeatureDbxrefQuery object.
78: *
79: * @param string $modelAlias The alias of a model in the query
80: * @param FeatureDbxrefQuery|Criteria $criteria Optional Criteria to build the query from
81: *
82: * @return FeatureDbxrefQuery
83: */
84: public static function create($modelAlias = null, $criteria = null)
85: {
86: if ($criteria instanceof FeatureDbxrefQuery) {
87: return $criteria;
88: }
89: $query = new FeatureDbxrefQuery();
90: if (null !== $modelAlias) {
91: $query->setModelAlias($modelAlias);
92: }
93: if ($criteria instanceof Criteria) {
94: $query->mergeWith($criteria);
95: }
96:
97: return $query;
98: }
99:
100: /**
101: * Find object by primary key.
102: * Propel uses the instance pool to skip the database if the object exists.
103: * Go fast if the query is untouched.
104: *
105: * <code>
106: * $obj = $c->findPk(12, $con);
107: * </code>
108: *
109: * @param mixed $key Primary key to use for the query
110: * @param PropelPDO $con an optional connection object
111: *
112: * @return FeatureDbxref|FeatureDbxref[]|mixed the result, formatted by the current formatter
113: */
114: public function findPk($key, $con = null)
115: {
116: if ($key === null) {
117: return null;
118: }
119: if ((null !== ($obj = FeatureDbxrefPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
120: // the object is alredy in the instance pool
121: return $obj;
122: }
123: if ($con === null) {
124: $con = Propel::getConnection(FeatureDbxrefPeer::DATABASE_NAME, Propel::CONNECTION_READ);
125: }
126: $this->basePreSelect($con);
127: if ($this->formatter || $this->modelAlias || $this->with || $this->select
128: || $this->selectColumns || $this->asColumns || $this->selectModifiers
129: || $this->map || $this->having || $this->joins) {
130: return $this->findPkComplex($key, $con);
131: } else {
132: return $this->findPkSimple($key, $con);
133: }
134: }
135:
136: /**
137: * Alias of findPk to use instance pooling
138: *
139: * @param mixed $key Primary key to use for the query
140: * @param PropelPDO $con A connection object
141: *
142: * @return FeatureDbxref A model object, or null if the key is not found
143: * @throws PropelException
144: */
145: public function findOneByFeatureDbxrefId($key, $con = null)
146: {
147: return $this->findPk($key, $con);
148: }
149:
150: /**
151: * Find object by primary key using raw SQL to go fast.
152: * Bypass doSelect() and the object formatter by using generated code.
153: *
154: * @param mixed $key Primary key to use for the query
155: * @param PropelPDO $con A connection object
156: *
157: * @return FeatureDbxref A model object, or null if the key is not found
158: * @throws PropelException
159: */
160: protected function findPkSimple($key, $con)
161: {
162: $sql = 'SELECT "feature_dbxref_id", "feature_id", "dbxref_id", "is_current" FROM "feature_dbxref" WHERE "feature_dbxref_id" = :p0';
163: try {
164: $stmt = $con->prepare($sql);
165: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
166: $stmt->execute();
167: } catch (Exception $e) {
168: Propel::log($e->getMessage(), Propel::LOG_ERR);
169: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
170: }
171: $obj = null;
172: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
173: $obj = new FeatureDbxref();
174: $obj->hydrate($row);
175: FeatureDbxrefPeer::addInstanceToPool($obj, (string) $key);
176: }
177: $stmt->closeCursor();
178:
179: return $obj;
180: }
181:
182: /**
183: * Find object by primary key.
184: *
185: * @param mixed $key Primary key to use for the query
186: * @param PropelPDO $con A connection object
187: *
188: * @return FeatureDbxref|FeatureDbxref[]|mixed the result, formatted by the current formatter
189: */
190: protected function findPkComplex($key, $con)
191: {
192: // As the query uses a PK condition, no limit(1) is necessary.
193: $criteria = $this->isKeepQuery() ? clone $this : $this;
194: $stmt = $criteria
195: ->filterByPrimaryKey($key)
196: ->doSelect($con);
197:
198: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
199: }
200:
201: /**
202: * Find objects by primary key
203: * <code>
204: * $objs = $c->findPks(array(12, 56, 832), $con);
205: * </code>
206: * @param array $keys Primary keys to use for the query
207: * @param PropelPDO $con an optional connection object
208: *
209: * @return PropelObjectCollection|FeatureDbxref[]|mixed the list of results, formatted by the current formatter
210: */
211: public function findPks($keys, $con = null)
212: {
213: if ($con === null) {
214: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
215: }
216: $this->basePreSelect($con);
217: $criteria = $this->isKeepQuery() ? clone $this : $this;
218: $stmt = $criteria
219: ->filterByPrimaryKeys($keys)
220: ->doSelect($con);
221:
222: return $criteria->getFormatter()->init($criteria)->format($stmt);
223: }
224:
225: /**
226: * Filter the query by primary key
227: *
228: * @param mixed $key Primary key to use for the query
229: *
230: * @return FeatureDbxrefQuery The current query, for fluid interface
231: */
232: public function filterByPrimaryKey($key)
233: {
234:
235: return $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $key, Criteria::EQUAL);
236: }
237:
238: /**
239: * Filter the query by a list of primary keys
240: *
241: * @param array $keys The list of primary key to use for the query
242: *
243: * @return FeatureDbxrefQuery The current query, for fluid interface
244: */
245: public function filterByPrimaryKeys($keys)
246: {
247:
248: return $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $keys, Criteria::IN);
249: }
250:
251: /**
252: * Filter the query on the feature_dbxref_id column
253: *
254: * Example usage:
255: * <code>
256: * $query->filterByFeatureDbxrefId(1234); // WHERE feature_dbxref_id = 1234
257: * $query->filterByFeatureDbxrefId(array(12, 34)); // WHERE feature_dbxref_id IN (12, 34)
258: * $query->filterByFeatureDbxrefId(array('min' => 12)); // WHERE feature_dbxref_id >= 12
259: * $query->filterByFeatureDbxrefId(array('max' => 12)); // WHERE feature_dbxref_id <= 12
260: * </code>
261: *
262: * @param mixed $featureDbxrefId The value to use as filter.
263: * Use scalar values for equality.
264: * Use array values for in_array() equivalent.
265: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
266: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
267: *
268: * @return FeatureDbxrefQuery The current query, for fluid interface
269: */
270: public function filterByFeatureDbxrefId($featureDbxrefId = null, $comparison = null)
271: {
272: if (is_array($featureDbxrefId)) {
273: $useMinMax = false;
274: if (isset($featureDbxrefId['min'])) {
275: $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $featureDbxrefId['min'], Criteria::GREATER_EQUAL);
276: $useMinMax = true;
277: }
278: if (isset($featureDbxrefId['max'])) {
279: $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $featureDbxrefId['max'], Criteria::LESS_EQUAL);
280: $useMinMax = true;
281: }
282: if ($useMinMax) {
283: return $this;
284: }
285: if (null === $comparison) {
286: $comparison = Criteria::IN;
287: }
288: }
289:
290: return $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $featureDbxrefId, $comparison);
291: }
292:
293: /**
294: * Filter the query on the feature_id column
295: *
296: * Example usage:
297: * <code>
298: * $query->filterByFeatureId(1234); // WHERE feature_id = 1234
299: * $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34)
300: * $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id >= 12
301: * $query->filterByFeatureId(array('max' => 12)); // WHERE feature_id <= 12
302: * </code>
303: *
304: * @see filterByFeature()
305: *
306: * @param mixed $featureId The value to use as filter.
307: * Use scalar values for equality.
308: * Use array values for in_array() equivalent.
309: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
310: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
311: *
312: * @return FeatureDbxrefQuery The current query, for fluid interface
313: */
314: public function filterByFeatureId($featureId = null, $comparison = null)
315: {
316: if (is_array($featureId)) {
317: $useMinMax = false;
318: if (isset($featureId['min'])) {
319: $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL);
320: $useMinMax = true;
321: }
322: if (isset($featureId['max'])) {
323: $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL);
324: $useMinMax = true;
325: }
326: if ($useMinMax) {
327: return $this;
328: }
329: if (null === $comparison) {
330: $comparison = Criteria::IN;
331: }
332: }
333:
334: return $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_ID, $featureId, $comparison);
335: }
336:
337: /**
338: * Filter the query on the dbxref_id column
339: *
340: * Example usage:
341: * <code>
342: * $query->filterByDbxrefId(1234); // WHERE dbxref_id = 1234
343: * $query->filterByDbxrefId(array(12, 34)); // WHERE dbxref_id IN (12, 34)
344: * $query->filterByDbxrefId(array('min' => 12)); // WHERE dbxref_id >= 12
345: * $query->filterByDbxrefId(array('max' => 12)); // WHERE dbxref_id <= 12
346: * </code>
347: *
348: * @see filterByDbxref()
349: *
350: * @param mixed $dbxrefId The value to use as filter.
351: * Use scalar values for equality.
352: * Use array values for in_array() equivalent.
353: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
354: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
355: *
356: * @return FeatureDbxrefQuery The current query, for fluid interface
357: */
358: public function filterByDbxrefId($dbxrefId = null, $comparison = null)
359: {
360: if (is_array($dbxrefId)) {
361: $useMinMax = false;
362: if (isset($dbxrefId['min'])) {
363: $this->addUsingAlias(FeatureDbxrefPeer::DBXREF_ID, $dbxrefId['min'], Criteria::GREATER_EQUAL);
364: $useMinMax = true;
365: }
366: if (isset($dbxrefId['max'])) {
367: $this->addUsingAlias(FeatureDbxrefPeer::DBXREF_ID, $dbxrefId['max'], Criteria::LESS_EQUAL);
368: $useMinMax = true;
369: }
370: if ($useMinMax) {
371: return $this;
372: }
373: if (null === $comparison) {
374: $comparison = Criteria::IN;
375: }
376: }
377:
378: return $this->addUsingAlias(FeatureDbxrefPeer::DBXREF_ID, $dbxrefId, $comparison);
379: }
380:
381: /**
382: * Filter the query on the is_current column
383: *
384: * Example usage:
385: * <code>
386: * $query->filterByIsCurrent(true); // WHERE is_current = true
387: * $query->filterByIsCurrent('yes'); // WHERE is_current = true
388: * </code>
389: *
390: * @param boolean|string $isCurrent The value to use as filter.
391: * Non-boolean arguments are converted using the following rules:
392: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
393: * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
394: * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
395: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
396: *
397: * @return FeatureDbxrefQuery The current query, for fluid interface
398: */
399: public function filterByIsCurrent($isCurrent = null, $comparison = null)
400: {
401: if (is_string($isCurrent)) {
402: $isCurrent = in_array(strtolower($isCurrent), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
403: }
404:
405: return $this->addUsingAlias(FeatureDbxrefPeer::IS_CURRENT, $isCurrent, $comparison);
406: }
407:
408: /**
409: * Filter the query by a related Dbxref object
410: *
411: * @param Dbxref|PropelObjectCollection $dbxref The related object(s) to use as filter
412: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
413: *
414: * @return FeatureDbxrefQuery The current query, for fluid interface
415: * @throws PropelException - if the provided filter is invalid.
416: */
417: public function filterByDbxref($dbxref, $comparison = null)
418: {
419: if ($dbxref instanceof Dbxref) {
420: return $this
421: ->addUsingAlias(FeatureDbxrefPeer::DBXREF_ID, $dbxref->getDbxrefId(), $comparison);
422: } elseif ($dbxref instanceof PropelObjectCollection) {
423: if (null === $comparison) {
424: $comparison = Criteria::IN;
425: }
426:
427: return $this
428: ->addUsingAlias(FeatureDbxrefPeer::DBXREF_ID, $dbxref->toKeyValue('PrimaryKey', 'DbxrefId'), $comparison);
429: } else {
430: throw new PropelException('filterByDbxref() only accepts arguments of type Dbxref or PropelCollection');
431: }
432: }
433:
434: /**
435: * Adds a JOIN clause to the query using the Dbxref relation
436: *
437: * @param string $relationAlias optional alias for the relation
438: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
439: *
440: * @return FeatureDbxrefQuery The current query, for fluid interface
441: */
442: public function joinDbxref($relationAlias = null, $joinType = Criteria::INNER_JOIN)
443: {
444: $tableMap = $this->getTableMap();
445: $relationMap = $tableMap->getRelation('Dbxref');
446:
447: // create a ModelJoin object for this join
448: $join = new ModelJoin();
449: $join->setJoinType($joinType);
450: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
451: if ($previousJoin = $this->getPreviousJoin()) {
452: $join->setPreviousJoin($previousJoin);
453: }
454:
455: // add the ModelJoin to the current object
456: if ($relationAlias) {
457: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
458: $this->addJoinObject($join, $relationAlias);
459: } else {
460: $this->addJoinObject($join, 'Dbxref');
461: }
462:
463: return $this;
464: }
465:
466: /**
467: * Use the Dbxref relation Dbxref object
468: *
469: * @see useQuery()
470: *
471: * @param string $relationAlias optional alias for the relation,
472: * to be used as main alias in the secondary query
473: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
474: *
475: * @return \cli_db\propel\DbxrefQuery A secondary query class using the current class as primary query
476: */
477: public function useDbxrefQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
478: {
479: return $this
480: ->joinDbxref($relationAlias, $joinType)
481: ->useQuery($relationAlias ? $relationAlias : 'Dbxref', '\cli_db\propel\DbxrefQuery');
482: }
483:
484: /**
485: * Filter the query by a related Feature object
486: *
487: * @param Feature|PropelObjectCollection $feature The related object(s) to use as filter
488: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
489: *
490: * @return FeatureDbxrefQuery The current query, for fluid interface
491: * @throws PropelException - if the provided filter is invalid.
492: */
493: public function filterByFeature($feature, $comparison = null)
494: {
495: if ($feature instanceof Feature) {
496: return $this
497: ->addUsingAlias(FeatureDbxrefPeer::FEATURE_ID, $feature->getFeatureId(), $comparison);
498: } elseif ($feature instanceof PropelObjectCollection) {
499: if (null === $comparison) {
500: $comparison = Criteria::IN;
501: }
502:
503: return $this
504: ->addUsingAlias(FeatureDbxrefPeer::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'FeatureId'), $comparison);
505: } else {
506: throw new PropelException('filterByFeature() only accepts arguments of type Feature or PropelCollection');
507: }
508: }
509:
510: /**
511: * Adds a JOIN clause to the query using the Feature relation
512: *
513: * @param string $relationAlias optional alias for the relation
514: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
515: *
516: * @return FeatureDbxrefQuery The current query, for fluid interface
517: */
518: public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
519: {
520: $tableMap = $this->getTableMap();
521: $relationMap = $tableMap->getRelation('Feature');
522:
523: // create a ModelJoin object for this join
524: $join = new ModelJoin();
525: $join->setJoinType($joinType);
526: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
527: if ($previousJoin = $this->getPreviousJoin()) {
528: $join->setPreviousJoin($previousJoin);
529: }
530:
531: // add the ModelJoin to the current object
532: if ($relationAlias) {
533: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
534: $this->addJoinObject($join, $relationAlias);
535: } else {
536: $this->addJoinObject($join, 'Feature');
537: }
538:
539: return $this;
540: }
541:
542: /**
543: * Use the Feature relation Feature object
544: *
545: * @see useQuery()
546: *
547: * @param string $relationAlias optional alias for the relation,
548: * to be used as main alias in the secondary query
549: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
550: *
551: * @return \cli_db\propel\FeatureQuery A secondary query class using the current class as primary query
552: */
553: public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
554: {
555: return $this
556: ->joinFeature($relationAlias, $joinType)
557: ->useQuery($relationAlias ? $relationAlias : 'Feature', '\cli_db\propel\FeatureQuery');
558: }
559:
560: /**
561: * Exclude object from result
562: *
563: * @param FeatureDbxref $featureDbxref Object to remove from the list of results
564: *
565: * @return FeatureDbxrefQuery The current query, for fluid interface
566: */
567: public function prune($featureDbxref = null)
568: {
569: if ($featureDbxref) {
570: $this->addUsingAlias(FeatureDbxrefPeer::FEATURE_DBXREF_ID, $featureDbxref->getFeatureDbxrefId(), Criteria::NOT_EQUAL);
571: }
572:
573: return $this;
574: }
575:
576: }
577: