1: <?php
2:
3: namespace Thelia\Model\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 Thelia\Model\Message;
16: use Thelia\Model\MessageVersion;
17: use Thelia\Model\MessageVersionPeer;
18: use Thelia\Model\MessageVersionQuery;
19:
20: /**
21: * Base class that represents a query for the 'message_version' table.
22: *
23: *
24: *
25: * @method MessageVersionQuery orderById($order = Criteria::ASC) Order by the id column
26: * @method MessageVersionQuery orderByCode($order = Criteria::ASC) Order by the code column
27: * @method MessageVersionQuery orderBySecured($order = Criteria::ASC) Order by the secured column
28: * @method MessageVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column
29: * @method MessageVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
30: * @method MessageVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
31: * @method MessageVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
32: * @method MessageVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
33: * @method MessageVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
34: *
35: * @method MessageVersionQuery groupById() Group by the id column
36: * @method MessageVersionQuery groupByCode() Group by the code column
37: * @method MessageVersionQuery groupBySecured() Group by the secured column
38: * @method MessageVersionQuery groupByRef() Group by the ref column
39: * @method MessageVersionQuery groupByCreatedAt() Group by the created_at column
40: * @method MessageVersionQuery groupByUpdatedAt() Group by the updated_at column
41: * @method MessageVersionQuery groupByVersion() Group by the version column
42: * @method MessageVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
43: * @method MessageVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
44: *
45: * @method MessageVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
46: * @method MessageVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
47: * @method MessageVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
48: *
49: * @method MessageVersionQuery leftJoinMessage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Message relation
50: * @method MessageVersionQuery rightJoinMessage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Message relation
51: * @method MessageVersionQuery innerJoinMessage($relationAlias = null) Adds a INNER JOIN clause to the query using the Message relation
52: *
53: * @method MessageVersion findOne(PropelPDO $con = null) Return the first MessageVersion matching the query
54: * @method MessageVersion findOneOrCreate(PropelPDO $con = null) Return the first MessageVersion matching the query, or a new MessageVersion object populated from the query conditions when no match is found
55: *
56: * @method MessageVersion findOneById(int $id) Return the first MessageVersion filtered by the id column
57: * @method MessageVersion findOneByCode(string $code) Return the first MessageVersion filtered by the code column
58: * @method MessageVersion findOneBySecured(int $secured) Return the first MessageVersion filtered by the secured column
59: * @method MessageVersion findOneByRef(string $ref) Return the first MessageVersion filtered by the ref column
60: * @method MessageVersion findOneByCreatedAt(string $created_at) Return the first MessageVersion filtered by the created_at column
61: * @method MessageVersion findOneByUpdatedAt(string $updated_at) Return the first MessageVersion filtered by the updated_at column
62: * @method MessageVersion findOneByVersion(int $version) Return the first MessageVersion filtered by the version column
63: * @method MessageVersion findOneByVersionCreatedAt(string $version_created_at) Return the first MessageVersion filtered by the version_created_at column
64: * @method MessageVersion findOneByVersionCreatedBy(string $version_created_by) Return the first MessageVersion filtered by the version_created_by column
65: *
66: * @method array findById(int $id) Return MessageVersion objects filtered by the id column
67: * @method array findByCode(string $code) Return MessageVersion objects filtered by the code column
68: * @method array findBySecured(int $secured) Return MessageVersion objects filtered by the secured column
69: * @method array findByRef(string $ref) Return MessageVersion objects filtered by the ref column
70: * @method array findByCreatedAt(string $created_at) Return MessageVersion objects filtered by the created_at column
71: * @method array findByUpdatedAt(string $updated_at) Return MessageVersion objects filtered by the updated_at column
72: * @method array findByVersion(int $version) Return MessageVersion objects filtered by the version column
73: * @method array findByVersionCreatedAt(string $version_created_at) Return MessageVersion objects filtered by the version_created_at column
74: * @method array findByVersionCreatedBy(string $version_created_by) Return MessageVersion objects filtered by the version_created_by column
75: *
76: * @package propel.generator.Thelia.Model.om
77: */
78: abstract class BaseMessageVersionQuery extends ModelCriteria
79: {
80: /**
81: * Initializes internal state of BaseMessageVersionQuery object.
82: *
83: * @param string $dbName The dabase name
84: * @param string $modelName The phpName of a model, e.g. 'Book'
85: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
86: */
87: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\MessageVersion', $modelAlias = null)
88: {
89: parent::__construct($dbName, $modelName, $modelAlias);
90: }
91:
92: /**
93: * Returns a new MessageVersionQuery object.
94: *
95: * @param string $modelAlias The alias of a model in the query
96: * @param MessageVersionQuery|Criteria $criteria Optional Criteria to build the query from
97: *
98: * @return MessageVersionQuery
99: */
100: public static function create($modelAlias = null, $criteria = null)
101: {
102: if ($criteria instanceof MessageVersionQuery) {
103: return $criteria;
104: }
105: $query = new MessageVersionQuery();
106: if (null !== $modelAlias) {
107: $query->setModelAlias($modelAlias);
108: }
109: if ($criteria instanceof Criteria) {
110: $query->mergeWith($criteria);
111: }
112:
113: return $query;
114: }
115:
116: /**
117: * Find object by primary key.
118: * Propel uses the instance pool to skip the database if the object exists.
119: * Go fast if the query is untouched.
120: *
121: * <code>
122: * $obj = $c->findPk(array(12, 34), $con);
123: * </code>
124: *
125: * @param array $key Primary key to use for the query
126: A Primary key composition: [$id, $version]
127: * @param PropelPDO $con an optional connection object
128: *
129: * @return MessageVersion|MessageVersion[]|mixed the result, formatted by the current formatter
130: */
131: public function findPk($key, $con = null)
132: {
133: if ($key === null) {
134: return null;
135: }
136: if ((null !== ($obj = MessageVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
137: // the object is alredy in the instance pool
138: return $obj;
139: }
140: if ($con === null) {
141: $con = Propel::getConnection(MessageVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
142: }
143: $this->basePreSelect($con);
144: if ($this->formatter || $this->modelAlias || $this->with || $this->select
145: || $this->selectColumns || $this->asColumns || $this->selectModifiers
146: || $this->map || $this->having || $this->joins) {
147: return $this->findPkComplex($key, $con);
148: } else {
149: return $this->findPkSimple($key, $con);
150: }
151: }
152:
153: /**
154: * Find object by primary key using raw SQL to go fast.
155: * Bypass doSelect() and the object formatter by using generated code.
156: *
157: * @param mixed $key Primary key to use for the query
158: * @param PropelPDO $con A connection object
159: *
160: * @return MessageVersion A model object, or null if the key is not found
161: * @throws PropelException
162: */
163: protected function findPkSimple($key, $con)
164: {
165: $sql = 'SELECT `ID`, `CODE`, `SECURED`, `REF`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `message_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
166: try {
167: $stmt = $con->prepare($sql);
168: $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
169: $stmt->bindValue(':p1', $key[1], 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 MessageVersion();
178: $obj->hydrate($row);
179: MessageVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
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 MessageVersion|MessageVersion[]|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(array(12, 56), array(832, 123), array(123, 456)), $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|MessageVersion[]|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 MessageVersionQuery The current query, for fluid interface
235: */
236: public function filterByPrimaryKey($key)
237: {
238: $this->addUsingAlias(MessageVersionPeer::ID, $key[0], Criteria::EQUAL);
239: $this->addUsingAlias(MessageVersionPeer::VERSION, $key[1], Criteria::EQUAL);
240:
241: return $this;
242: }
243:
244: /**
245: * Filter the query by a list of primary keys
246: *
247: * @param array $keys The list of primary key to use for the query
248: *
249: * @return MessageVersionQuery The current query, for fluid interface
250: */
251: public function filterByPrimaryKeys($keys)
252: {
253: if (empty($keys)) {
254: return $this->add(null, '1<>1', Criteria::CUSTOM);
255: }
256: foreach ($keys as $key) {
257: $cton0 = $this->getNewCriterion(MessageVersionPeer::ID, $key[0], Criteria::EQUAL);
258: $cton1 = $this->getNewCriterion(MessageVersionPeer::VERSION, $key[1], Criteria::EQUAL);
259: $cton0->addAnd($cton1);
260: $this->addOr($cton0);
261: }
262:
263: return $this;
264: }
265:
266: /**
267: * Filter the query on the id column
268: *
269: * Example usage:
270: * <code>
271: * $query->filterById(1234); // WHERE id = 1234
272: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
273: * $query->filterById(array('min' => 12)); // WHERE id > 12
274: * </code>
275: *
276: * @see filterByMessage()
277: *
278: * @param mixed $id The value to use as filter.
279: * Use scalar values for equality.
280: * Use array values for in_array() equivalent.
281: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
282: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
283: *
284: * @return MessageVersionQuery The current query, for fluid interface
285: */
286: public function filterById($id = null, $comparison = null)
287: {
288: if (is_array($id) && null === $comparison) {
289: $comparison = Criteria::IN;
290: }
291:
292: return $this->addUsingAlias(MessageVersionPeer::ID, $id, $comparison);
293: }
294:
295: /**
296: * Filter the query on the code column
297: *
298: * Example usage:
299: * <code>
300: * $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
301: * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
302: * </code>
303: *
304: * @param string $code The value to use as filter.
305: * Accepts wildcards (* and % trigger a LIKE)
306: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
307: *
308: * @return MessageVersionQuery The current query, for fluid interface
309: */
310: public function filterByCode($code = null, $comparison = null)
311: {
312: if (null === $comparison) {
313: if (is_array($code)) {
314: $comparison = Criteria::IN;
315: } elseif (preg_match('/[\%\*]/', $code)) {
316: $code = str_replace('*', '%', $code);
317: $comparison = Criteria::LIKE;
318: }
319: }
320:
321: return $this->addUsingAlias(MessageVersionPeer::CODE, $code, $comparison);
322: }
323:
324: /**
325: * Filter the query on the secured column
326: *
327: * Example usage:
328: * <code>
329: * $query->filterBySecured(1234); // WHERE secured = 1234
330: * $query->filterBySecured(array(12, 34)); // WHERE secured IN (12, 34)
331: * $query->filterBySecured(array('min' => 12)); // WHERE secured > 12
332: * </code>
333: *
334: * @param mixed $secured The value to use as filter.
335: * Use scalar values for equality.
336: * Use array values for in_array() equivalent.
337: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
338: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
339: *
340: * @return MessageVersionQuery The current query, for fluid interface
341: */
342: public function filterBySecured($secured = null, $comparison = null)
343: {
344: if (is_array($secured)) {
345: $useMinMax = false;
346: if (isset($secured['min'])) {
347: $this->addUsingAlias(MessageVersionPeer::SECURED, $secured['min'], Criteria::GREATER_EQUAL);
348: $useMinMax = true;
349: }
350: if (isset($secured['max'])) {
351: $this->addUsingAlias(MessageVersionPeer::SECURED, $secured['max'], Criteria::LESS_EQUAL);
352: $useMinMax = true;
353: }
354: if ($useMinMax) {
355: return $this;
356: }
357: if (null === $comparison) {
358: $comparison = Criteria::IN;
359: }
360: }
361:
362: return $this->addUsingAlias(MessageVersionPeer::SECURED, $secured, $comparison);
363: }
364:
365: /**
366: * Filter the query on the ref column
367: *
368: * Example usage:
369: * <code>
370: * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
371: * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
372: * </code>
373: *
374: * @param string $ref The value to use as filter.
375: * Accepts wildcards (* and % trigger a LIKE)
376: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
377: *
378: * @return MessageVersionQuery The current query, for fluid interface
379: */
380: public function filterByRef($ref = null, $comparison = null)
381: {
382: if (null === $comparison) {
383: if (is_array($ref)) {
384: $comparison = Criteria::IN;
385: } elseif (preg_match('/[\%\*]/', $ref)) {
386: $ref = str_replace('*', '%', $ref);
387: $comparison = Criteria::LIKE;
388: }
389: }
390:
391: return $this->addUsingAlias(MessageVersionPeer::REF, $ref, $comparison);
392: }
393:
394: /**
395: * Filter the query on the created_at column
396: *
397: * Example usage:
398: * <code>
399: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
400: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
401: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
402: * </code>
403: *
404: * @param mixed $createdAt The value to use as filter.
405: * Values can be integers (unix timestamps), DateTime objects, or strings.
406: * Empty strings are treated as NULL.
407: * Use scalar values for equality.
408: * Use array values for in_array() equivalent.
409: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
410: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
411: *
412: * @return MessageVersionQuery The current query, for fluid interface
413: */
414: public function filterByCreatedAt($createdAt = null, $comparison = null)
415: {
416: if (is_array($createdAt)) {
417: $useMinMax = false;
418: if (isset($createdAt['min'])) {
419: $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
420: $useMinMax = true;
421: }
422: if (isset($createdAt['max'])) {
423: $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
424: $useMinMax = true;
425: }
426: if ($useMinMax) {
427: return $this;
428: }
429: if (null === $comparison) {
430: $comparison = Criteria::IN;
431: }
432: }
433:
434: return $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt, $comparison);
435: }
436:
437: /**
438: * Filter the query on the updated_at column
439: *
440: * Example usage:
441: * <code>
442: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
443: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
444: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
445: * </code>
446: *
447: * @param mixed $updatedAt The value to use as filter.
448: * Values can be integers (unix timestamps), DateTime objects, or strings.
449: * Empty strings are treated as NULL.
450: * Use scalar values for equality.
451: * Use array values for in_array() equivalent.
452: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
453: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
454: *
455: * @return MessageVersionQuery The current query, for fluid interface
456: */
457: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
458: {
459: if (is_array($updatedAt)) {
460: $useMinMax = false;
461: if (isset($updatedAt['min'])) {
462: $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
463: $useMinMax = true;
464: }
465: if (isset($updatedAt['max'])) {
466: $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
467: $useMinMax = true;
468: }
469: if ($useMinMax) {
470: return $this;
471: }
472: if (null === $comparison) {
473: $comparison = Criteria::IN;
474: }
475: }
476:
477: return $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt, $comparison);
478: }
479:
480: /**
481: * Filter the query on the version column
482: *
483: * Example usage:
484: * <code>
485: * $query->filterByVersion(1234); // WHERE version = 1234
486: * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
487: * $query->filterByVersion(array('min' => 12)); // WHERE version > 12
488: * </code>
489: *
490: * @param mixed $version The value to use as filter.
491: * Use scalar values for equality.
492: * Use array values for in_array() equivalent.
493: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
494: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
495: *
496: * @return MessageVersionQuery The current query, for fluid interface
497: */
498: public function filterByVersion($version = null, $comparison = null)
499: {
500: if (is_array($version) && null === $comparison) {
501: $comparison = Criteria::IN;
502: }
503:
504: return $this->addUsingAlias(MessageVersionPeer::VERSION, $version, $comparison);
505: }
506:
507: /**
508: * Filter the query on the version_created_at column
509: *
510: * Example usage:
511: * <code>
512: * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
513: * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
514: * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
515: * </code>
516: *
517: * @param mixed $versionCreatedAt The value to use as filter.
518: * Values can be integers (unix timestamps), DateTime objects, or strings.
519: * Empty strings are treated as NULL.
520: * Use scalar values for equality.
521: * Use array values for in_array() equivalent.
522: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
523: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
524: *
525: * @return MessageVersionQuery The current query, for fluid interface
526: */
527: public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
528: {
529: if (is_array($versionCreatedAt)) {
530: $useMinMax = false;
531: if (isset($versionCreatedAt['min'])) {
532: $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
533: $useMinMax = true;
534: }
535: if (isset($versionCreatedAt['max'])) {
536: $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
537: $useMinMax = true;
538: }
539: if ($useMinMax) {
540: return $this;
541: }
542: if (null === $comparison) {
543: $comparison = Criteria::IN;
544: }
545: }
546:
547: return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
548: }
549:
550: /**
551: * Filter the query on the version_created_by column
552: *
553: * Example usage:
554: * <code>
555: * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
556: * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
557: * </code>
558: *
559: * @param string $versionCreatedBy The value to use as filter.
560: * Accepts wildcards (* and % trigger a LIKE)
561: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
562: *
563: * @return MessageVersionQuery The current query, for fluid interface
564: */
565: public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
566: {
567: if (null === $comparison) {
568: if (is_array($versionCreatedBy)) {
569: $comparison = Criteria::IN;
570: } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
571: $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
572: $comparison = Criteria::LIKE;
573: }
574: }
575:
576: return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
577: }
578:
579: /**
580: * Filter the query by a related Message object
581: *
582: * @param Message|PropelObjectCollection $message The related object(s) to use as filter
583: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
584: *
585: * @return MessageVersionQuery The current query, for fluid interface
586: * @throws PropelException - if the provided filter is invalid.
587: */
588: public function filterByMessage($message, $comparison = null)
589: {
590: if ($message instanceof Message) {
591: return $this
592: ->addUsingAlias(MessageVersionPeer::ID, $message->getId(), $comparison);
593: } elseif ($message instanceof PropelObjectCollection) {
594: if (null === $comparison) {
595: $comparison = Criteria::IN;
596: }
597:
598: return $this
599: ->addUsingAlias(MessageVersionPeer::ID, $message->toKeyValue('PrimaryKey', 'Id'), $comparison);
600: } else {
601: throw new PropelException('filterByMessage() only accepts arguments of type Message or PropelCollection');
602: }
603: }
604:
605: /**
606: * Adds a JOIN clause to the query using the Message relation
607: *
608: * @param string $relationAlias optional alias for the relation
609: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
610: *
611: * @return MessageVersionQuery The current query, for fluid interface
612: */
613: public function joinMessage($relationAlias = null, $joinType = Criteria::INNER_JOIN)
614: {
615: $tableMap = $this->getTableMap();
616: $relationMap = $tableMap->getRelation('Message');
617:
618: // create a ModelJoin object for this join
619: $join = new ModelJoin();
620: $join->setJoinType($joinType);
621: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
622: if ($previousJoin = $this->getPreviousJoin()) {
623: $join->setPreviousJoin($previousJoin);
624: }
625:
626: // add the ModelJoin to the current object
627: if ($relationAlias) {
628: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
629: $this->addJoinObject($join, $relationAlias);
630: } else {
631: $this->addJoinObject($join, 'Message');
632: }
633:
634: return $this;
635: }
636:
637: /**
638: * Use the Message relation Message object
639: *
640: * @see useQuery()
641: *
642: * @param string $relationAlias optional alias for the relation,
643: * to be used as main alias in the secondary query
644: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
645: *
646: * @return \Thelia\Model\MessageQuery A secondary query class using the current class as primary query
647: */
648: public function useMessageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
649: {
650: return $this
651: ->joinMessage($relationAlias, $joinType)
652: ->useQuery($relationAlias ? $relationAlias : 'Message', '\Thelia\Model\MessageQuery');
653: }
654:
655: /**
656: * Exclude object from result
657: *
658: * @param MessageVersion $messageVersion Object to remove from the list of results
659: *
660: * @return MessageVersionQuery The current query, for fluid interface
661: */
662: public function prune($messageVersion = null)
663: {
664: if ($messageVersion) {
665: $this->addCond('pruneCond0', $this->getAliasedColName(MessageVersionPeer::ID), $messageVersion->getId(), Criteria::NOT_EQUAL);
666: $this->addCond('pruneCond1', $this->getAliasedColName(MessageVersionPeer::VERSION), $messageVersion->getVersion(), Criteria::NOT_EQUAL);
667: $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
668: }
669:
670: return $this;
671: }
672:
673: }
674: