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