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