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\Biomaterial;
16: use cli_db\propel\BiomaterialRelationship;
17: use cli_db\propel\BiomaterialRelationshipPeer;
18: use cli_db\propel\BiomaterialRelationshipQuery;
19: use cli_db\propel\Cvterm;
20:
21: /**
22: * Base class that represents a query for the 'biomaterial_relationship' table.
23: *
24: *
25: *
26: * @method BiomaterialRelationshipQuery orderByBiomaterialRelationshipId($order = Criteria::ASC) Order by the biomaterial_relationship_id column
27: * @method BiomaterialRelationshipQuery orderBySubjectId($order = Criteria::ASC) Order by the subject_id column
28: * @method BiomaterialRelationshipQuery orderByTypeId($order = Criteria::ASC) Order by the type_id column
29: * @method BiomaterialRelationshipQuery orderByObjectId($order = Criteria::ASC) Order by the object_id column
30: *
31: * @method BiomaterialRelationshipQuery groupByBiomaterialRelationshipId() Group by the biomaterial_relationship_id column
32: * @method BiomaterialRelationshipQuery groupBySubjectId() Group by the subject_id column
33: * @method BiomaterialRelationshipQuery groupByTypeId() Group by the type_id column
34: * @method BiomaterialRelationshipQuery groupByObjectId() Group by the object_id column
35: *
36: * @method BiomaterialRelationshipQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
37: * @method BiomaterialRelationshipQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
38: * @method BiomaterialRelationshipQuery innerJoin($relation) Adds a INNER JOIN clause to the query
39: *
40: * @method BiomaterialRelationshipQuery leftJoinBiomaterialRelatedByObjectId($relationAlias = null) Adds a LEFT JOIN clause to the query using the BiomaterialRelatedByObjectId relation
41: * @method BiomaterialRelationshipQuery rightJoinBiomaterialRelatedByObjectId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BiomaterialRelatedByObjectId relation
42: * @method BiomaterialRelationshipQuery innerJoinBiomaterialRelatedByObjectId($relationAlias = null) Adds a INNER JOIN clause to the query using the BiomaterialRelatedByObjectId relation
43: *
44: * @method BiomaterialRelationshipQuery leftJoinBiomaterialRelatedBySubjectId($relationAlias = null) Adds a LEFT JOIN clause to the query using the BiomaterialRelatedBySubjectId relation
45: * @method BiomaterialRelationshipQuery rightJoinBiomaterialRelatedBySubjectId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BiomaterialRelatedBySubjectId relation
46: * @method BiomaterialRelationshipQuery innerJoinBiomaterialRelatedBySubjectId($relationAlias = null) Adds a INNER JOIN clause to the query using the BiomaterialRelatedBySubjectId relation
47: *
48: * @method BiomaterialRelationshipQuery leftJoinCvterm($relationAlias = null) Adds a LEFT JOIN clause to the query using the Cvterm relation
49: * @method BiomaterialRelationshipQuery rightJoinCvterm($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Cvterm relation
50: * @method BiomaterialRelationshipQuery innerJoinCvterm($relationAlias = null) Adds a INNER JOIN clause to the query using the Cvterm relation
51: *
52: * @method BiomaterialRelationship findOne(PropelPDO $con = null) Return the first BiomaterialRelationship matching the query
53: * @method BiomaterialRelationship findOneOrCreate(PropelPDO $con = null) Return the first BiomaterialRelationship matching the query, or a new BiomaterialRelationship object populated from the query conditions when no match is found
54: *
55: * @method BiomaterialRelationship findOneBySubjectId(int $subject_id) Return the first BiomaterialRelationship filtered by the subject_id column
56: * @method BiomaterialRelationship findOneByTypeId(int $type_id) Return the first BiomaterialRelationship filtered by the type_id column
57: * @method BiomaterialRelationship findOneByObjectId(int $object_id) Return the first BiomaterialRelationship filtered by the object_id column
58: *
59: * @method array findByBiomaterialRelationshipId(int $biomaterial_relationship_id) Return BiomaterialRelationship objects filtered by the biomaterial_relationship_id column
60: * @method array findBySubjectId(int $subject_id) Return BiomaterialRelationship objects filtered by the subject_id column
61: * @method array findByTypeId(int $type_id) Return BiomaterialRelationship objects filtered by the type_id column
62: * @method array findByObjectId(int $object_id) Return BiomaterialRelationship objects filtered by the object_id column
63: *
64: * @package propel.generator.cli_db.om
65: */
66: abstract class BaseBiomaterialRelationshipQuery extends ModelCriteria
67: {
68: /**
69: * Initializes internal state of BaseBiomaterialRelationshipQuery object.
70: *
71: * @param string $dbName The dabase name
72: * @param string $modelName The phpName of a model, e.g. 'Book'
73: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
74: */
75: public function __construct($dbName = 'cli_db', $modelName = 'cli_db\\propel\\BiomaterialRelationship', $modelAlias = null)
76: {
77: parent::__construct($dbName, $modelName, $modelAlias);
78: }
79:
80: /**
81: * Returns a new BiomaterialRelationshipQuery object.
82: *
83: * @param string $modelAlias The alias of a model in the query
84: * @param BiomaterialRelationshipQuery|Criteria $criteria Optional Criteria to build the query from
85: *
86: * @return BiomaterialRelationshipQuery
87: */
88: public static function create($modelAlias = null, $criteria = null)
89: {
90: if ($criteria instanceof BiomaterialRelationshipQuery) {
91: return $criteria;
92: }
93: $query = new BiomaterialRelationshipQuery();
94: if (null !== $modelAlias) {
95: $query->setModelAlias($modelAlias);
96: }
97: if ($criteria instanceof Criteria) {
98: $query->mergeWith($criteria);
99: }
100:
101: return $query;
102: }
103:
104: /**
105: * Find object by primary key.
106: * Propel uses the instance pool to skip the database if the object exists.
107: * Go fast if the query is untouched.
108: *
109: * <code>
110: * $obj = $c->findPk(12, $con);
111: * </code>
112: *
113: * @param mixed $key Primary key to use for the query
114: * @param PropelPDO $con an optional connection object
115: *
116: * @return BiomaterialRelationship|BiomaterialRelationship[]|mixed the result, formatted by the current formatter
117: */
118: public function findPk($key, $con = null)
119: {
120: if ($key === null) {
121: return null;
122: }
123: if ((null !== ($obj = BiomaterialRelationshipPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
124: // the object is alredy in the instance pool
125: return $obj;
126: }
127: if ($con === null) {
128: $con = Propel::getConnection(BiomaterialRelationshipPeer::DATABASE_NAME, Propel::CONNECTION_READ);
129: }
130: $this->basePreSelect($con);
131: if ($this->formatter || $this->modelAlias || $this->with || $this->select
132: || $this->selectColumns || $this->asColumns || $this->selectModifiers
133: || $this->map || $this->having || $this->joins) {
134: return $this->findPkComplex($key, $con);
135: } else {
136: return $this->findPkSimple($key, $con);
137: }
138: }
139:
140: /**
141: * Alias of findPk to use instance pooling
142: *
143: * @param mixed $key Primary key to use for the query
144: * @param PropelPDO $con A connection object
145: *
146: * @return BiomaterialRelationship A model object, or null if the key is not found
147: * @throws PropelException
148: */
149: public function findOneByBiomaterialRelationshipId($key, $con = null)
150: {
151: return $this->findPk($key, $con);
152: }
153:
154: /**
155: * Find object by primary key using raw SQL to go fast.
156: * Bypass doSelect() and the object formatter by using generated code.
157: *
158: * @param mixed $key Primary key to use for the query
159: * @param PropelPDO $con A connection object
160: *
161: * @return BiomaterialRelationship A model object, or null if the key is not found
162: * @throws PropelException
163: */
164: protected function findPkSimple($key, $con)
165: {
166: $sql = 'SELECT "biomaterial_relationship_id", "subject_id", "type_id", "object_id" FROM "biomaterial_relationship" WHERE "biomaterial_relationship_id" = :p0';
167: try {
168: $stmt = $con->prepare($sql);
169: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
170: $stmt->execute();
171: } catch (Exception $e) {
172: Propel::log($e->getMessage(), Propel::LOG_ERR);
173: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
174: }
175: $obj = null;
176: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
177: $obj = new BiomaterialRelationship();
178: $obj->hydrate($row);
179: BiomaterialRelationshipPeer::addInstanceToPool($obj, (string) $key);
180: }
181: $stmt->closeCursor();
182:
183: return $obj;
184: }
185:
186: /**
187: * Find object by primary key.
188: *
189: * @param mixed $key Primary key to use for the query
190: * @param PropelPDO $con A connection object
191: *
192: * @return BiomaterialRelationship|BiomaterialRelationship[]|mixed the result, formatted by the current formatter
193: */
194: protected function findPkComplex($key, $con)
195: {
196: // As the query uses a PK condition, no limit(1) is necessary.
197: $criteria = $this->isKeepQuery() ? clone $this : $this;
198: $stmt = $criteria
199: ->filterByPrimaryKey($key)
200: ->doSelect($con);
201:
202: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
203: }
204:
205: /**
206: * Find objects by primary key
207: * <code>
208: * $objs = $c->findPks(array(12, 56, 832), $con);
209: * </code>
210: * @param array $keys Primary keys to use for the query
211: * @param PropelPDO $con an optional connection object
212: *
213: * @return PropelObjectCollection|BiomaterialRelationship[]|mixed the list of results, formatted by the current formatter
214: */
215: public function findPks($keys, $con = null)
216: {
217: if ($con === null) {
218: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
219: }
220: $this->basePreSelect($con);
221: $criteria = $this->isKeepQuery() ? clone $this : $this;
222: $stmt = $criteria
223: ->filterByPrimaryKeys($keys)
224: ->doSelect($con);
225:
226: return $criteria->getFormatter()->init($criteria)->format($stmt);
227: }
228:
229: /**
230: * Filter the query by primary key
231: *
232: * @param mixed $key Primary key to use for the query
233: *
234: * @return BiomaterialRelationshipQuery The current query, for fluid interface
235: */
236: public function filterByPrimaryKey($key)
237: {
238:
239: return $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $key, Criteria::EQUAL);
240: }
241:
242: /**
243: * Filter the query by a list of primary keys
244: *
245: * @param array $keys The list of primary key to use for the query
246: *
247: * @return BiomaterialRelationshipQuery The current query, for fluid interface
248: */
249: public function filterByPrimaryKeys($keys)
250: {
251:
252: return $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $keys, Criteria::IN);
253: }
254:
255: /**
256: * Filter the query on the biomaterial_relationship_id column
257: *
258: * Example usage:
259: * <code>
260: * $query->filterByBiomaterialRelationshipId(1234); // WHERE biomaterial_relationship_id = 1234
261: * $query->filterByBiomaterialRelationshipId(array(12, 34)); // WHERE biomaterial_relationship_id IN (12, 34)
262: * $query->filterByBiomaterialRelationshipId(array('min' => 12)); // WHERE biomaterial_relationship_id >= 12
263: * $query->filterByBiomaterialRelationshipId(array('max' => 12)); // WHERE biomaterial_relationship_id <= 12
264: * </code>
265: *
266: * @param mixed $biomaterialRelationshipId The value to use as filter.
267: * Use scalar values for equality.
268: * Use array values for in_array() equivalent.
269: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
270: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
271: *
272: * @return BiomaterialRelationshipQuery The current query, for fluid interface
273: */
274: public function filterByBiomaterialRelationshipId($biomaterialRelationshipId = null, $comparison = null)
275: {
276: if (is_array($biomaterialRelationshipId)) {
277: $useMinMax = false;
278: if (isset($biomaterialRelationshipId['min'])) {
279: $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $biomaterialRelationshipId['min'], Criteria::GREATER_EQUAL);
280: $useMinMax = true;
281: }
282: if (isset($biomaterialRelationshipId['max'])) {
283: $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $biomaterialRelationshipId['max'], Criteria::LESS_EQUAL);
284: $useMinMax = true;
285: }
286: if ($useMinMax) {
287: return $this;
288: }
289: if (null === $comparison) {
290: $comparison = Criteria::IN;
291: }
292: }
293:
294: return $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $biomaterialRelationshipId, $comparison);
295: }
296:
297: /**
298: * Filter the query on the subject_id column
299: *
300: * Example usage:
301: * <code>
302: * $query->filterBySubjectId(1234); // WHERE subject_id = 1234
303: * $query->filterBySubjectId(array(12, 34)); // WHERE subject_id IN (12, 34)
304: * $query->filterBySubjectId(array('min' => 12)); // WHERE subject_id >= 12
305: * $query->filterBySubjectId(array('max' => 12)); // WHERE subject_id <= 12
306: * </code>
307: *
308: * @see filterByBiomaterialRelatedBySubjectId()
309: *
310: * @param mixed $subjectId The value to use as filter.
311: * Use scalar values for equality.
312: * Use array values for in_array() equivalent.
313: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
314: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
315: *
316: * @return BiomaterialRelationshipQuery The current query, for fluid interface
317: */
318: public function filterBySubjectId($subjectId = null, $comparison = null)
319: {
320: if (is_array($subjectId)) {
321: $useMinMax = false;
322: if (isset($subjectId['min'])) {
323: $this->addUsingAlias(BiomaterialRelationshipPeer::SUBJECT_ID, $subjectId['min'], Criteria::GREATER_EQUAL);
324: $useMinMax = true;
325: }
326: if (isset($subjectId['max'])) {
327: $this->addUsingAlias(BiomaterialRelationshipPeer::SUBJECT_ID, $subjectId['max'], Criteria::LESS_EQUAL);
328: $useMinMax = true;
329: }
330: if ($useMinMax) {
331: return $this;
332: }
333: if (null === $comparison) {
334: $comparison = Criteria::IN;
335: }
336: }
337:
338: return $this->addUsingAlias(BiomaterialRelationshipPeer::SUBJECT_ID, $subjectId, $comparison);
339: }
340:
341: /**
342: * Filter the query on the type_id column
343: *
344: * Example usage:
345: * <code>
346: * $query->filterByTypeId(1234); // WHERE type_id = 1234
347: * $query->filterByTypeId(array(12, 34)); // WHERE type_id IN (12, 34)
348: * $query->filterByTypeId(array('min' => 12)); // WHERE type_id >= 12
349: * $query->filterByTypeId(array('max' => 12)); // WHERE type_id <= 12
350: * </code>
351: *
352: * @see filterByCvterm()
353: *
354: * @param mixed $typeId The value to use as filter.
355: * Use scalar values for equality.
356: * Use array values for in_array() equivalent.
357: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
358: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
359: *
360: * @return BiomaterialRelationshipQuery The current query, for fluid interface
361: */
362: public function filterByTypeId($typeId = null, $comparison = null)
363: {
364: if (is_array($typeId)) {
365: $useMinMax = false;
366: if (isset($typeId['min'])) {
367: $this->addUsingAlias(BiomaterialRelationshipPeer::TYPE_ID, $typeId['min'], Criteria::GREATER_EQUAL);
368: $useMinMax = true;
369: }
370: if (isset($typeId['max'])) {
371: $this->addUsingAlias(BiomaterialRelationshipPeer::TYPE_ID, $typeId['max'], Criteria::LESS_EQUAL);
372: $useMinMax = true;
373: }
374: if ($useMinMax) {
375: return $this;
376: }
377: if (null === $comparison) {
378: $comparison = Criteria::IN;
379: }
380: }
381:
382: return $this->addUsingAlias(BiomaterialRelationshipPeer::TYPE_ID, $typeId, $comparison);
383: }
384:
385: /**
386: * Filter the query on the object_id column
387: *
388: * Example usage:
389: * <code>
390: * $query->filterByObjectId(1234); // WHERE object_id = 1234
391: * $query->filterByObjectId(array(12, 34)); // WHERE object_id IN (12, 34)
392: * $query->filterByObjectId(array('min' => 12)); // WHERE object_id >= 12
393: * $query->filterByObjectId(array('max' => 12)); // WHERE object_id <= 12
394: * </code>
395: *
396: * @see filterByBiomaterialRelatedByObjectId()
397: *
398: * @param mixed $objectId The value to use as filter.
399: * Use scalar values for equality.
400: * Use array values for in_array() equivalent.
401: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
402: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
403: *
404: * @return BiomaterialRelationshipQuery The current query, for fluid interface
405: */
406: public function filterByObjectId($objectId = null, $comparison = null)
407: {
408: if (is_array($objectId)) {
409: $useMinMax = false;
410: if (isset($objectId['min'])) {
411: $this->addUsingAlias(BiomaterialRelationshipPeer::OBJECT_ID, $objectId['min'], Criteria::GREATER_EQUAL);
412: $useMinMax = true;
413: }
414: if (isset($objectId['max'])) {
415: $this->addUsingAlias(BiomaterialRelationshipPeer::OBJECT_ID, $objectId['max'], Criteria::LESS_EQUAL);
416: $useMinMax = true;
417: }
418: if ($useMinMax) {
419: return $this;
420: }
421: if (null === $comparison) {
422: $comparison = Criteria::IN;
423: }
424: }
425:
426: return $this->addUsingAlias(BiomaterialRelationshipPeer::OBJECT_ID, $objectId, $comparison);
427: }
428:
429: /**
430: * Filter the query by a related Biomaterial object
431: *
432: * @param Biomaterial|PropelObjectCollection $biomaterial The related object(s) to use as filter
433: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
434: *
435: * @return BiomaterialRelationshipQuery The current query, for fluid interface
436: * @throws PropelException - if the provided filter is invalid.
437: */
438: public function filterByBiomaterialRelatedByObjectId($biomaterial, $comparison = null)
439: {
440: if ($biomaterial instanceof Biomaterial) {
441: return $this
442: ->addUsingAlias(BiomaterialRelationshipPeer::OBJECT_ID, $biomaterial->getBiomaterialId(), $comparison);
443: } elseif ($biomaterial instanceof PropelObjectCollection) {
444: if (null === $comparison) {
445: $comparison = Criteria::IN;
446: }
447:
448: return $this
449: ->addUsingAlias(BiomaterialRelationshipPeer::OBJECT_ID, $biomaterial->toKeyValue('PrimaryKey', 'BiomaterialId'), $comparison);
450: } else {
451: throw new PropelException('filterByBiomaterialRelatedByObjectId() only accepts arguments of type Biomaterial or PropelCollection');
452: }
453: }
454:
455: /**
456: * Adds a JOIN clause to the query using the BiomaterialRelatedByObjectId relation
457: *
458: * @param string $relationAlias optional alias for the relation
459: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
460: *
461: * @return BiomaterialRelationshipQuery The current query, for fluid interface
462: */
463: public function joinBiomaterialRelatedByObjectId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
464: {
465: $tableMap = $this->getTableMap();
466: $relationMap = $tableMap->getRelation('BiomaterialRelatedByObjectId');
467:
468: // create a ModelJoin object for this join
469: $join = new ModelJoin();
470: $join->setJoinType($joinType);
471: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
472: if ($previousJoin = $this->getPreviousJoin()) {
473: $join->setPreviousJoin($previousJoin);
474: }
475:
476: // add the ModelJoin to the current object
477: if ($relationAlias) {
478: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
479: $this->addJoinObject($join, $relationAlias);
480: } else {
481: $this->addJoinObject($join, 'BiomaterialRelatedByObjectId');
482: }
483:
484: return $this;
485: }
486:
487: /**
488: * Use the BiomaterialRelatedByObjectId relation Biomaterial object
489: *
490: * @see useQuery()
491: *
492: * @param string $relationAlias optional alias for the relation,
493: * to be used as main alias in the secondary query
494: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
495: *
496: * @return \cli_db\propel\BiomaterialQuery A secondary query class using the current class as primary query
497: */
498: public function useBiomaterialRelatedByObjectIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
499: {
500: return $this
501: ->joinBiomaterialRelatedByObjectId($relationAlias, $joinType)
502: ->useQuery($relationAlias ? $relationAlias : 'BiomaterialRelatedByObjectId', '\cli_db\propel\BiomaterialQuery');
503: }
504:
505: /**
506: * Filter the query by a related Biomaterial object
507: *
508: * @param Biomaterial|PropelObjectCollection $biomaterial The related object(s) to use as filter
509: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
510: *
511: * @return BiomaterialRelationshipQuery The current query, for fluid interface
512: * @throws PropelException - if the provided filter is invalid.
513: */
514: public function filterByBiomaterialRelatedBySubjectId($biomaterial, $comparison = null)
515: {
516: if ($biomaterial instanceof Biomaterial) {
517: return $this
518: ->addUsingAlias(BiomaterialRelationshipPeer::SUBJECT_ID, $biomaterial->getBiomaterialId(), $comparison);
519: } elseif ($biomaterial instanceof PropelObjectCollection) {
520: if (null === $comparison) {
521: $comparison = Criteria::IN;
522: }
523:
524: return $this
525: ->addUsingAlias(BiomaterialRelationshipPeer::SUBJECT_ID, $biomaterial->toKeyValue('PrimaryKey', 'BiomaterialId'), $comparison);
526: } else {
527: throw new PropelException('filterByBiomaterialRelatedBySubjectId() only accepts arguments of type Biomaterial or PropelCollection');
528: }
529: }
530:
531: /**
532: * Adds a JOIN clause to the query using the BiomaterialRelatedBySubjectId relation
533: *
534: * @param string $relationAlias optional alias for the relation
535: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
536: *
537: * @return BiomaterialRelationshipQuery The current query, for fluid interface
538: */
539: public function joinBiomaterialRelatedBySubjectId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
540: {
541: $tableMap = $this->getTableMap();
542: $relationMap = $tableMap->getRelation('BiomaterialRelatedBySubjectId');
543:
544: // create a ModelJoin object for this join
545: $join = new ModelJoin();
546: $join->setJoinType($joinType);
547: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
548: if ($previousJoin = $this->getPreviousJoin()) {
549: $join->setPreviousJoin($previousJoin);
550: }
551:
552: // add the ModelJoin to the current object
553: if ($relationAlias) {
554: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
555: $this->addJoinObject($join, $relationAlias);
556: } else {
557: $this->addJoinObject($join, 'BiomaterialRelatedBySubjectId');
558: }
559:
560: return $this;
561: }
562:
563: /**
564: * Use the BiomaterialRelatedBySubjectId relation Biomaterial object
565: *
566: * @see useQuery()
567: *
568: * @param string $relationAlias optional alias for the relation,
569: * to be used as main alias in the secondary query
570: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
571: *
572: * @return \cli_db\propel\BiomaterialQuery A secondary query class using the current class as primary query
573: */
574: public function useBiomaterialRelatedBySubjectIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
575: {
576: return $this
577: ->joinBiomaterialRelatedBySubjectId($relationAlias, $joinType)
578: ->useQuery($relationAlias ? $relationAlias : 'BiomaterialRelatedBySubjectId', '\cli_db\propel\BiomaterialQuery');
579: }
580:
581: /**
582: * Filter the query by a related Cvterm object
583: *
584: * @param Cvterm|PropelObjectCollection $cvterm The related object(s) to use as filter
585: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
586: *
587: * @return BiomaterialRelationshipQuery The current query, for fluid interface
588: * @throws PropelException - if the provided filter is invalid.
589: */
590: public function filterByCvterm($cvterm, $comparison = null)
591: {
592: if ($cvterm instanceof Cvterm) {
593: return $this
594: ->addUsingAlias(BiomaterialRelationshipPeer::TYPE_ID, $cvterm->getCvtermId(), $comparison);
595: } elseif ($cvterm instanceof PropelObjectCollection) {
596: if (null === $comparison) {
597: $comparison = Criteria::IN;
598: }
599:
600: return $this
601: ->addUsingAlias(BiomaterialRelationshipPeer::TYPE_ID, $cvterm->toKeyValue('PrimaryKey', 'CvtermId'), $comparison);
602: } else {
603: throw new PropelException('filterByCvterm() only accepts arguments of type Cvterm or PropelCollection');
604: }
605: }
606:
607: /**
608: * Adds a JOIN clause to the query using the Cvterm relation
609: *
610: * @param string $relationAlias optional alias for the relation
611: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
612: *
613: * @return BiomaterialRelationshipQuery The current query, for fluid interface
614: */
615: public function joinCvterm($relationAlias = null, $joinType = Criteria::INNER_JOIN)
616: {
617: $tableMap = $this->getTableMap();
618: $relationMap = $tableMap->getRelation('Cvterm');
619:
620: // create a ModelJoin object for this join
621: $join = new ModelJoin();
622: $join->setJoinType($joinType);
623: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
624: if ($previousJoin = $this->getPreviousJoin()) {
625: $join->setPreviousJoin($previousJoin);
626: }
627:
628: // add the ModelJoin to the current object
629: if ($relationAlias) {
630: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
631: $this->addJoinObject($join, $relationAlias);
632: } else {
633: $this->addJoinObject($join, 'Cvterm');
634: }
635:
636: return $this;
637: }
638:
639: /**
640: * Use the Cvterm relation Cvterm object
641: *
642: * @see useQuery()
643: *
644: * @param string $relationAlias optional alias for the relation,
645: * to be used as main alias in the secondary query
646: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
647: *
648: * @return \cli_db\propel\CvtermQuery A secondary query class using the current class as primary query
649: */
650: public function useCvtermQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
651: {
652: return $this
653: ->joinCvterm($relationAlias, $joinType)
654: ->useQuery($relationAlias ? $relationAlias : 'Cvterm', '\cli_db\propel\CvtermQuery');
655: }
656:
657: /**
658: * Exclude object from result
659: *
660: * @param BiomaterialRelationship $biomaterialRelationship Object to remove from the list of results
661: *
662: * @return BiomaterialRelationshipQuery The current query, for fluid interface
663: */
664: public function prune($biomaterialRelationship = null)
665: {
666: if ($biomaterialRelationship) {
667: $this->addUsingAlias(BiomaterialRelationshipPeer::BIOMATERIAL_RELATIONSHIP_ID, $biomaterialRelationship->getBiomaterialRelationshipId(), Criteria::NOT_EQUAL);
668: }
669:
670: return $this;
671: }
672:
673: }
674: