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\Attribute;
16: use Thelia\Model\AttributeDesc;
17: use Thelia\Model\AttributeDescPeer;
18: use Thelia\Model\AttributeDescQuery;
19:
20: /**
21: * Base class that represents a query for the 'attribute_desc' table.
22: *
23: *
24: *
25: * @method AttributeDescQuery orderById($order = Criteria::ASC) Order by the id column
26: * @method AttributeDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
27: * @method AttributeDescQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
28: * @method AttributeDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
29: * @method AttributeDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
30: * @method AttributeDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
31: * @method AttributeDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
32: * @method AttributeDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
33: *
34: * @method AttributeDescQuery groupById() Group by the id column
35: * @method AttributeDescQuery groupByLang() Group by the lang column
36: * @method AttributeDescQuery groupByAttributeId() Group by the attribute_id column
37: * @method AttributeDescQuery groupByTitle() Group by the title column
38: * @method AttributeDescQuery groupByDescription() Group by the description column
39: * @method AttributeDescQuery groupByChapo() Group by the chapo column
40: * @method AttributeDescQuery groupByCreatedAt() Group by the created_at column
41: * @method AttributeDescQuery groupByUpdatedAt() Group by the updated_at column
42: *
43: * @method AttributeDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
44: * @method AttributeDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
45: * @method AttributeDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
46: *
47: * @method AttributeDescQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
48: * @method AttributeDescQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
49: * @method AttributeDescQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
50: *
51: * @method AttributeDesc findOne(PropelPDO $con = null) Return the first AttributeDesc matching the query
52: * @method AttributeDesc findOneOrCreate(PropelPDO $con = null) Return the first AttributeDesc matching the query, or a new AttributeDesc object populated from the query conditions when no match is found
53: *
54: * @method AttributeDesc findOneById(int $id) Return the first AttributeDesc filtered by the id column
55: * @method AttributeDesc findOneByLang(string $lang) Return the first AttributeDesc filtered by the lang column
56: * @method AttributeDesc findOneByAttributeId(int $attribute_id) Return the first AttributeDesc filtered by the attribute_id column
57: * @method AttributeDesc findOneByTitle(string $title) Return the first AttributeDesc filtered by the title column
58: * @method AttributeDesc findOneByDescription(string $description) Return the first AttributeDesc filtered by the description column
59: * @method AttributeDesc findOneByChapo(string $chapo) Return the first AttributeDesc filtered by the chapo column
60: * @method AttributeDesc findOneByCreatedAt(string $created_at) Return the first AttributeDesc filtered by the created_at column
61: * @method AttributeDesc findOneByUpdatedAt(string $updated_at) Return the first AttributeDesc filtered by the updated_at column
62: *
63: * @method array findById(int $id) Return AttributeDesc objects filtered by the id column
64: * @method array findByLang(string $lang) Return AttributeDesc objects filtered by the lang column
65: * @method array findByAttributeId(int $attribute_id) Return AttributeDesc objects filtered by the attribute_id column
66: * @method array findByTitle(string $title) Return AttributeDesc objects filtered by the title column
67: * @method array findByDescription(string $description) Return AttributeDesc objects filtered by the description column
68: * @method array findByChapo(string $chapo) Return AttributeDesc objects filtered by the chapo column
69: * @method array findByCreatedAt(string $created_at) Return AttributeDesc objects filtered by the created_at column
70: * @method array findByUpdatedAt(string $updated_at) Return AttributeDesc objects filtered by the updated_at column
71: *
72: * @package propel.generator.Thelia.Model.om
73: */
74: abstract class BaseAttributeDescQuery extends ModelCriteria
75: {
76: /**
77: * Initializes internal state of BaseAttributeDescQuery 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\\AttributeDesc', $modelAlias = null)
84: {
85: parent::__construct($dbName, $modelName, $modelAlias);
86: }
87:
88: /**
89: * Returns a new AttributeDescQuery object.
90: *
91: * @param string $modelAlias The alias of a model in the query
92: * @param AttributeDescQuery|Criteria $criteria Optional Criteria to build the query from
93: *
94: * @return AttributeDescQuery
95: */
96: public static function create($modelAlias = null, $criteria = null)
97: {
98: if ($criteria instanceof AttributeDescQuery) {
99: return $criteria;
100: }
101: $query = new AttributeDescQuery();
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 AttributeDesc|AttributeDesc[]|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 = AttributeDescPeer::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(AttributeDescPeer::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 AttributeDesc 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`, `LANG`, `ATTRIBUTE_ID`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_desc` 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 AttributeDesc();
172: $obj->hydrate($row);
173: AttributeDescPeer::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 AttributeDesc|AttributeDesc[]|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|AttributeDesc[]|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 AttributeDescQuery The current query, for fluid interface
229: */
230: public function filterByPrimaryKey($key)
231: {
232:
233: return $this->addUsingAlias(AttributeDescPeer::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 AttributeDescQuery The current query, for fluid interface
242: */
243: public function filterByPrimaryKeys($keys)
244: {
245:
246: return $this->addUsingAlias(AttributeDescPeer::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 AttributeDescQuery 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(AttributeDescPeer::ID, $id, $comparison);
274: }
275:
276: /**
277: * Filter the query on the lang column
278: *
279: * Example usage:
280: * <code>
281: * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
282: * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
283: * </code>
284: *
285: * @param string $lang 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 AttributeDescQuery The current query, for fluid interface
290: */
291: public function filterByLang($lang = null, $comparison = null)
292: {
293: if (null === $comparison) {
294: if (is_array($lang)) {
295: $comparison = Criteria::IN;
296: } elseif (preg_match('/[\%\*]/', $lang)) {
297: $lang = str_replace('*', '%', $lang);
298: $comparison = Criteria::LIKE;
299: }
300: }
301:
302: return $this->addUsingAlias(AttributeDescPeer::LANG, $lang, $comparison);
303: }
304:
305: /**
306: * Filter the query on the attribute_id column
307: *
308: * Example usage:
309: * <code>
310: * $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
311: * $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
312: * $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
313: * </code>
314: *
315: * @see filterByAttribute()
316: *
317: * @param mixed $attributeId The value to use as filter.
318: * Use scalar values for equality.
319: * Use array values for in_array() equivalent.
320: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
321: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
322: *
323: * @return AttributeDescQuery The current query, for fluid interface
324: */
325: public function filterByAttributeId($attributeId = null, $comparison = null)
326: {
327: if (is_array($attributeId)) {
328: $useMinMax = false;
329: if (isset($attributeId['min'])) {
330: $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
331: $useMinMax = true;
332: }
333: if (isset($attributeId['max'])) {
334: $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
335: $useMinMax = true;
336: }
337: if ($useMinMax) {
338: return $this;
339: }
340: if (null === $comparison) {
341: $comparison = Criteria::IN;
342: }
343: }
344:
345: return $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId, $comparison);
346: }
347:
348: /**
349: * Filter the query on the title column
350: *
351: * Example usage:
352: * <code>
353: * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
354: * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
355: * </code>
356: *
357: * @param string $title The value to use as filter.
358: * Accepts wildcards (* and % trigger a LIKE)
359: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
360: *
361: * @return AttributeDescQuery The current query, for fluid interface
362: */
363: public function filterByTitle($title = null, $comparison = null)
364: {
365: if (null === $comparison) {
366: if (is_array($title)) {
367: $comparison = Criteria::IN;
368: } elseif (preg_match('/[\%\*]/', $title)) {
369: $title = str_replace('*', '%', $title);
370: $comparison = Criteria::LIKE;
371: }
372: }
373:
374: return $this->addUsingAlias(AttributeDescPeer::TITLE, $title, $comparison);
375: }
376:
377: /**
378: * Filter the query on the description column
379: *
380: * Example usage:
381: * <code>
382: * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
383: * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
384: * </code>
385: *
386: * @param string $description The value to use as filter.
387: * Accepts wildcards (* and % trigger a LIKE)
388: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
389: *
390: * @return AttributeDescQuery The current query, for fluid interface
391: */
392: public function filterByDescription($description = null, $comparison = null)
393: {
394: if (null === $comparison) {
395: if (is_array($description)) {
396: $comparison = Criteria::IN;
397: } elseif (preg_match('/[\%\*]/', $description)) {
398: $description = str_replace('*', '%', $description);
399: $comparison = Criteria::LIKE;
400: }
401: }
402:
403: return $this->addUsingAlias(AttributeDescPeer::DESCRIPTION, $description, $comparison);
404: }
405:
406: /**
407: * Filter the query on the chapo column
408: *
409: * Example usage:
410: * <code>
411: * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
412: * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
413: * </code>
414: *
415: * @param string $chapo The value to use as filter.
416: * Accepts wildcards (* and % trigger a LIKE)
417: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
418: *
419: * @return AttributeDescQuery The current query, for fluid interface
420: */
421: public function filterByChapo($chapo = null, $comparison = null)
422: {
423: if (null === $comparison) {
424: if (is_array($chapo)) {
425: $comparison = Criteria::IN;
426: } elseif (preg_match('/[\%\*]/', $chapo)) {
427: $chapo = str_replace('*', '%', $chapo);
428: $comparison = Criteria::LIKE;
429: }
430: }
431:
432: return $this->addUsingAlias(AttributeDescPeer::CHAPO, $chapo, $comparison);
433: }
434:
435: /**
436: * Filter the query on the created_at column
437: *
438: * Example usage:
439: * <code>
440: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
441: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
442: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
443: * </code>
444: *
445: * @param mixed $createdAt The value to use as filter.
446: * Values can be integers (unix timestamps), DateTime objects, or strings.
447: * Empty strings are treated as NULL.
448: * Use scalar values for equality.
449: * Use array values for in_array() equivalent.
450: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
451: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
452: *
453: * @return AttributeDescQuery The current query, for fluid interface
454: */
455: public function filterByCreatedAt($createdAt = null, $comparison = null)
456: {
457: if (is_array($createdAt)) {
458: $useMinMax = false;
459: if (isset($createdAt['min'])) {
460: $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
461: $useMinMax = true;
462: }
463: if (isset($createdAt['max'])) {
464: $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
465: $useMinMax = true;
466: }
467: if ($useMinMax) {
468: return $this;
469: }
470: if (null === $comparison) {
471: $comparison = Criteria::IN;
472: }
473: }
474:
475: return $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt, $comparison);
476: }
477:
478: /**
479: * Filter the query on the updated_at column
480: *
481: * Example usage:
482: * <code>
483: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
484: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
485: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
486: * </code>
487: *
488: * @param mixed $updatedAt The value to use as filter.
489: * Values can be integers (unix timestamps), DateTime objects, or strings.
490: * Empty strings are treated as NULL.
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 AttributeDescQuery The current query, for fluid interface
497: */
498: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
499: {
500: if (is_array($updatedAt)) {
501: $useMinMax = false;
502: if (isset($updatedAt['min'])) {
503: $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
504: $useMinMax = true;
505: }
506: if (isset($updatedAt['max'])) {
507: $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
508: $useMinMax = true;
509: }
510: if ($useMinMax) {
511: return $this;
512: }
513: if (null === $comparison) {
514: $comparison = Criteria::IN;
515: }
516: }
517:
518: return $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt, $comparison);
519: }
520:
521: /**
522: * Filter the query by a related Attribute object
523: *
524: * @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
525: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
526: *
527: * @return AttributeDescQuery The current query, for fluid interface
528: * @throws PropelException - if the provided filter is invalid.
529: */
530: public function filterByAttribute($attribute, $comparison = null)
531: {
532: if ($attribute instanceof Attribute) {
533: return $this
534: ->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
535: } elseif ($attribute instanceof PropelObjectCollection) {
536: if (null === $comparison) {
537: $comparison = Criteria::IN;
538: }
539:
540: return $this
541: ->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
542: } else {
543: throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
544: }
545: }
546:
547: /**
548: * Adds a JOIN clause to the query using the Attribute relation
549: *
550: * @param string $relationAlias optional alias for the relation
551: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
552: *
553: * @return AttributeDescQuery The current query, for fluid interface
554: */
555: public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
556: {
557: $tableMap = $this->getTableMap();
558: $relationMap = $tableMap->getRelation('Attribute');
559:
560: // create a ModelJoin object for this join
561: $join = new ModelJoin();
562: $join->setJoinType($joinType);
563: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
564: if ($previousJoin = $this->getPreviousJoin()) {
565: $join->setPreviousJoin($previousJoin);
566: }
567:
568: // add the ModelJoin to the current object
569: if ($relationAlias) {
570: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
571: $this->addJoinObject($join, $relationAlias);
572: } else {
573: $this->addJoinObject($join, 'Attribute');
574: }
575:
576: return $this;
577: }
578:
579: /**
580: * Use the Attribute relation Attribute object
581: *
582: * @see useQuery()
583: *
584: * @param string $relationAlias optional alias for the relation,
585: * to be used as main alias in the secondary query
586: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
587: *
588: * @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
589: */
590: public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
591: {
592: return $this
593: ->joinAttribute($relationAlias, $joinType)
594: ->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
595: }
596:
597: /**
598: * Exclude object from result
599: *
600: * @param AttributeDesc $attributeDesc Object to remove from the list of results
601: *
602: * @return AttributeDescQuery The current query, for fluid interface
603: */
604: public function prune($attributeDesc = null)
605: {
606: if ($attributeDesc) {
607: $this->addUsingAlias(AttributeDescPeer::ID, $attributeDesc->getId(), Criteria::NOT_EQUAL);
608: }
609:
610: return $this;
611: }
612:
613: // timestampable behavior
614:
615: /**
616: * Filter by the latest updated
617: *
618: * @param int $nbDays Maximum age of the latest update in days
619: *
620: * @return AttributeDescQuery The current query, for fluid interface
621: */
622: public function recentlyUpdated($nbDays = 7)
623: {
624: return $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
625: }
626:
627: /**
628: * Order by update date desc
629: *
630: * @return AttributeDescQuery The current query, for fluid interface
631: */
632: public function lastUpdatedFirst()
633: {
634: return $this->addDescendingOrderByColumn(AttributeDescPeer::UPDATED_AT);
635: }
636:
637: /**
638: * Order by update date asc
639: *
640: * @return AttributeDescQuery The current query, for fluid interface
641: */
642: public function firstUpdatedFirst()
643: {
644: return $this->addAscendingOrderByColumn(AttributeDescPeer::UPDATED_AT);
645: }
646:
647: /**
648: * Filter by the latest created
649: *
650: * @param int $nbDays Maximum age of in days
651: *
652: * @return AttributeDescQuery The current query, for fluid interface
653: */
654: public function recentlyCreated($nbDays = 7)
655: {
656: return $this->addUsingAlias(AttributeDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
657: }
658:
659: /**
660: * Order by create date desc
661: *
662: * @return AttributeDescQuery The current query, for fluid interface
663: */
664: public function lastCreatedFirst()
665: {
666: return $this->addDescendingOrderByColumn(AttributeDescPeer::CREATED_AT);
667: }
668:
669: /**
670: * Order by create date asc
671: *
672: * @return AttributeDescQuery The current query, for fluid interface
673: */
674: public function firstCreatedFirst()
675: {
676: return $this->addAscendingOrderByColumn(AttributeDescPeer::CREATED_AT);
677: }
678: }
679: