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: * $query->filterById(array('max' => 12)); // WHERE id <= 12
275: * </code>
276: *
277: * @see filterByMessage()
278: *
279: * @param mixed $id The value to use as filter.
280: * Use scalar values for equality.
281: * Use array values for in_array() equivalent.
282: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
283: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
284: *
285: * @return MessageVersionQuery The current query, for fluid interface
286: */
287: public function filterById($id = null, $comparison = null)
288: {
289: if (is_array($id)) {
290: $useMinMax = false;
291: if (isset($id['min'])) {
292: $this->addUsingAlias(MessageVersionPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
293: $useMinMax = true;
294: }
295: if (isset($id['max'])) {
296: $this->addUsingAlias(MessageVersionPeer::ID, $id['max'], Criteria::LESS_EQUAL);
297: $useMinMax = true;
298: }
299: if ($useMinMax) {
300: return $this;
301: }
302: if (null === $comparison) {
303: $comparison = Criteria::IN;
304: }
305: }
306:
307: return $this->addUsingAlias(MessageVersionPeer::ID, $id, $comparison);
308: }
309:
310: /**
311: * Filter the query on the code column
312: *
313: * Example usage:
314: * <code>
315: * $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
316: * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
317: * </code>
318: *
319: * @param string $code The value to use as filter.
320: * Accepts wildcards (* and % trigger a LIKE)
321: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
322: *
323: * @return MessageVersionQuery The current query, for fluid interface
324: */
325: public function filterByCode($code = null, $comparison = null)
326: {
327: if (null === $comparison) {
328: if (is_array($code)) {
329: $comparison = Criteria::IN;
330: } elseif (preg_match('/[\%\*]/', $code)) {
331: $code = str_replace('*', '%', $code);
332: $comparison = Criteria::LIKE;
333: }
334: }
335:
336: return $this->addUsingAlias(MessageVersionPeer::CODE, $code, $comparison);
337: }
338:
339: /**
340: * Filter the query on the secured column
341: *
342: * Example usage:
343: * <code>
344: * $query->filterBySecured(1234); // WHERE secured = 1234
345: * $query->filterBySecured(array(12, 34)); // WHERE secured IN (12, 34)
346: * $query->filterBySecured(array('min' => 12)); // WHERE secured >= 12
347: * $query->filterBySecured(array('max' => 12)); // WHERE secured <= 12
348: * </code>
349: *
350: * @param mixed $secured 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 MessageVersionQuery The current query, for fluid interface
357: */
358: public function filterBySecured($secured = null, $comparison = null)
359: {
360: if (is_array($secured)) {
361: $useMinMax = false;
362: if (isset($secured['min'])) {
363: $this->addUsingAlias(MessageVersionPeer::SECURED, $secured['min'], Criteria::GREATER_EQUAL);
364: $useMinMax = true;
365: }
366: if (isset($secured['max'])) {
367: $this->addUsingAlias(MessageVersionPeer::SECURED, $secured['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(MessageVersionPeer::SECURED, $secured, $comparison);
379: }
380:
381: /**
382: * Filter the query on the ref column
383: *
384: * Example usage:
385: * <code>
386: * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
387: * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
388: * </code>
389: *
390: * @param string $ref The value to use as filter.
391: * Accepts wildcards (* and % trigger a LIKE)
392: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
393: *
394: * @return MessageVersionQuery The current query, for fluid interface
395: */
396: public function filterByRef($ref = null, $comparison = null)
397: {
398: if (null === $comparison) {
399: if (is_array($ref)) {
400: $comparison = Criteria::IN;
401: } elseif (preg_match('/[\%\*]/', $ref)) {
402: $ref = str_replace('*', '%', $ref);
403: $comparison = Criteria::LIKE;
404: }
405: }
406:
407: return $this->addUsingAlias(MessageVersionPeer::REF, $ref, $comparison);
408: }
409:
410: /**
411: * Filter the query on the created_at column
412: *
413: * Example usage:
414: * <code>
415: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
416: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
417: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
418: * </code>
419: *
420: * @param mixed $createdAt The value to use as filter.
421: * Values can be integers (unix timestamps), DateTime objects, or strings.
422: * Empty strings are treated as NULL.
423: * Use scalar values for equality.
424: * Use array values for in_array() equivalent.
425: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
426: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
427: *
428: * @return MessageVersionQuery The current query, for fluid interface
429: */
430: public function filterByCreatedAt($createdAt = null, $comparison = null)
431: {
432: if (is_array($createdAt)) {
433: $useMinMax = false;
434: if (isset($createdAt['min'])) {
435: $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
436: $useMinMax = true;
437: }
438: if (isset($createdAt['max'])) {
439: $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
440: $useMinMax = true;
441: }
442: if ($useMinMax) {
443: return $this;
444: }
445: if (null === $comparison) {
446: $comparison = Criteria::IN;
447: }
448: }
449:
450: return $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt, $comparison);
451: }
452:
453: /**
454: * Filter the query on the updated_at column
455: *
456: * Example usage:
457: * <code>
458: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
459: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
460: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
461: * </code>
462: *
463: * @param mixed $updatedAt The value to use as filter.
464: * Values can be integers (unix timestamps), DateTime objects, or strings.
465: * Empty strings are treated as NULL.
466: * Use scalar values for equality.
467: * Use array values for in_array() equivalent.
468: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
469: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
470: *
471: * @return MessageVersionQuery The current query, for fluid interface
472: */
473: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
474: {
475: if (is_array($updatedAt)) {
476: $useMinMax = false;
477: if (isset($updatedAt['min'])) {
478: $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
479: $useMinMax = true;
480: }
481: if (isset($updatedAt['max'])) {
482: $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
483: $useMinMax = true;
484: }
485: if ($useMinMax) {
486: return $this;
487: }
488: if (null === $comparison) {
489: $comparison = Criteria::IN;
490: }
491: }
492:
493: return $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt, $comparison);
494: }
495:
496: /**
497: * Filter the query on the version column
498: *
499: * Example usage:
500: * <code>
501: * $query->filterByVersion(1234); // WHERE version = 1234
502: * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
503: * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12
504: * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12
505: * </code>
506: *
507: * @param mixed $version The value to use as filter.
508: * Use scalar values for equality.
509: * Use array values for in_array() equivalent.
510: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
511: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
512: *
513: * @return MessageVersionQuery The current query, for fluid interface
514: */
515: public function filterByVersion($version = null, $comparison = null)
516: {
517: if (is_array($version)) {
518: $useMinMax = false;
519: if (isset($version['min'])) {
520: $this->addUsingAlias(MessageVersionPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
521: $useMinMax = true;
522: }
523: if (isset($version['max'])) {
524: $this->addUsingAlias(MessageVersionPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
525: $useMinMax = true;
526: }
527: if ($useMinMax) {
528: return $this;
529: }
530: if (null === $comparison) {
531: $comparison = Criteria::IN;
532: }
533: }
534:
535: return $this->addUsingAlias(MessageVersionPeer::VERSION, $version, $comparison);
536: }
537:
538: /**
539: * Filter the query on the version_created_at column
540: *
541: * Example usage:
542: * <code>
543: * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
544: * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
545: * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
546: * </code>
547: *
548: * @param mixed $versionCreatedAt The value to use as filter.
549: * Values can be integers (unix timestamps), DateTime objects, or strings.
550: * Empty strings are treated as NULL.
551: * Use scalar values for equality.
552: * Use array values for in_array() equivalent.
553: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
554: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
555: *
556: * @return MessageVersionQuery The current query, for fluid interface
557: */
558: public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
559: {
560: if (is_array($versionCreatedAt)) {
561: $useMinMax = false;
562: if (isset($versionCreatedAt['min'])) {
563: $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
564: $useMinMax = true;
565: }
566: if (isset($versionCreatedAt['max'])) {
567: $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
568: $useMinMax = true;
569: }
570: if ($useMinMax) {
571: return $this;
572: }
573: if (null === $comparison) {
574: $comparison = Criteria::IN;
575: }
576: }
577:
578: return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
579: }
580:
581: /**
582: * Filter the query on the version_created_by column
583: *
584: * Example usage:
585: * <code>
586: * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
587: * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
588: * </code>
589: *
590: * @param string $versionCreatedBy The value to use as filter.
591: * Accepts wildcards (* and % trigger a LIKE)
592: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
593: *
594: * @return MessageVersionQuery The current query, for fluid interface
595: */
596: public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
597: {
598: if (null === $comparison) {
599: if (is_array($versionCreatedBy)) {
600: $comparison = Criteria::IN;
601: } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
602: $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
603: $comparison = Criteria::LIKE;
604: }
605: }
606:
607: return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
608: }
609:
610: /**
611: * Filter the query by a related Message object
612: *
613: * @param Message|PropelObjectCollection $message The related object(s) to use as filter
614: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
615: *
616: * @return MessageVersionQuery The current query, for fluid interface
617: * @throws PropelException - if the provided filter is invalid.
618: */
619: public function filterByMessage($message, $comparison = null)
620: {
621: if ($message instanceof Message) {
622: return $this
623: ->addUsingAlias(MessageVersionPeer::ID, $message->getId(), $comparison);
624: } elseif ($message instanceof PropelObjectCollection) {
625: if (null === $comparison) {
626: $comparison = Criteria::IN;
627: }
628:
629: return $this
630: ->addUsingAlias(MessageVersionPeer::ID, $message->toKeyValue('PrimaryKey', 'Id'), $comparison);
631: } else {
632: throw new PropelException('filterByMessage() only accepts arguments of type Message or PropelCollection');
633: }
634: }
635:
636: /**
637: * Adds a JOIN clause to the query using the Message relation
638: *
639: * @param string $relationAlias optional alias for the relation
640: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
641: *
642: * @return MessageVersionQuery The current query, for fluid interface
643: */
644: public function joinMessage($relationAlias = null, $joinType = Criteria::INNER_JOIN)
645: {
646: $tableMap = $this->getTableMap();
647: $relationMap = $tableMap->getRelation('Message');
648:
649: // create a ModelJoin object for this join
650: $join = new ModelJoin();
651: $join->setJoinType($joinType);
652: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
653: if ($previousJoin = $this->getPreviousJoin()) {
654: $join->setPreviousJoin($previousJoin);
655: }
656:
657: // add the ModelJoin to the current object
658: if ($relationAlias) {
659: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
660: $this->addJoinObject($join, $relationAlias);
661: } else {
662: $this->addJoinObject($join, 'Message');
663: }
664:
665: return $this;
666: }
667:
668: /**
669: * Use the Message relation Message object
670: *
671: * @see useQuery()
672: *
673: * @param string $relationAlias optional alias for the relation,
674: * to be used as main alias in the secondary query
675: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
676: *
677: * @return \Thelia\Model\MessageQuery A secondary query class using the current class as primary query
678: */
679: public function useMessageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
680: {
681: return $this
682: ->joinMessage($relationAlias, $joinType)
683: ->useQuery($relationAlias ? $relationAlias : 'Message', '\Thelia\Model\MessageQuery');
684: }
685:
686: /**
687: * Exclude object from result
688: *
689: * @param MessageVersion $messageVersion Object to remove from the list of results
690: *
691: * @return MessageVersionQuery The current query, for fluid interface
692: */
693: public function prune($messageVersion = null)
694: {
695: if ($messageVersion) {
696: $this->addCond('pruneCond0', $this->getAliasedColName(MessageVersionPeer::ID), $messageVersion->getId(), Criteria::NOT_EQUAL);
697: $this->addCond('pruneCond1', $this->getAliasedColName(MessageVersionPeer::VERSION), $messageVersion->getVersion(), Criteria::NOT_EQUAL);
698: $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
699: }
700:
701: return $this;
702: }
703:
704: }
705: