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