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\Feature;
16: use Thelia\Model\FeatureAv;
17: use Thelia\Model\FeatureCategory;
18: use Thelia\Model\FeatureI18n;
19: use Thelia\Model\FeaturePeer;
20: use Thelia\Model\FeatureProd;
21: use Thelia\Model\FeatureQuery;
22:
23: /**
24: * Base class that represents a query for the 'feature' table.
25: *
26: *
27: *
28: * @method FeatureQuery orderById($order = Criteria::ASC) Order by the id column
29: * @method FeatureQuery orderByVisible($order = Criteria::ASC) Order by the visible column
30: * @method FeatureQuery orderByPosition($order = Criteria::ASC) Order by the position column
31: * @method FeatureQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
32: * @method FeatureQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
33: *
34: * @method FeatureQuery groupById() Group by the id column
35: * @method FeatureQuery groupByVisible() Group by the visible column
36: * @method FeatureQuery groupByPosition() Group by the position column
37: * @method FeatureQuery groupByCreatedAt() Group by the created_at column
38: * @method FeatureQuery groupByUpdatedAt() Group by the updated_at column
39: *
40: * @method FeatureQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
41: * @method FeatureQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
42: * @method FeatureQuery innerJoin($relation) Adds a INNER JOIN clause to the query
43: *
44: * @method FeatureQuery leftJoinFeatureAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureAv relation
45: * @method FeatureQuery rightJoinFeatureAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureAv relation
46: * @method FeatureQuery innerJoinFeatureAv($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureAv relation
47: *
48: * @method FeatureQuery leftJoinFeatureProd($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureProd relation
49: * @method FeatureQuery rightJoinFeatureProd($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProd relation
50: * @method FeatureQuery innerJoinFeatureProd($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProd relation
51: *
52: * @method FeatureQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
53: * @method FeatureQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
54: * @method FeatureQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
55: *
56: * @method FeatureQuery leftJoinFeatureI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureI18n relation
57: * @method FeatureQuery rightJoinFeatureI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureI18n relation
58: * @method FeatureQuery innerJoinFeatureI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureI18n relation
59: *
60: * @method Feature findOne(PropelPDO $con = null) Return the first Feature matching the query
61: * @method Feature findOneOrCreate(PropelPDO $con = null) Return the first Feature matching the query, or a new Feature object populated from the query conditions when no match is found
62: *
63: * @method Feature findOneByVisible(int $visible) Return the first Feature filtered by the visible column
64: * @method Feature findOneByPosition(int $position) Return the first Feature filtered by the position column
65: * @method Feature findOneByCreatedAt(string $created_at) Return the first Feature filtered by the created_at column
66: * @method Feature findOneByUpdatedAt(string $updated_at) Return the first Feature filtered by the updated_at column
67: *
68: * @method array findById(int $id) Return Feature objects filtered by the id column
69: * @method array findByVisible(int $visible) Return Feature objects filtered by the visible column
70: * @method array findByPosition(int $position) Return Feature objects filtered by the position column
71: * @method array findByCreatedAt(string $created_at) Return Feature objects filtered by the created_at column
72: * @method array findByUpdatedAt(string $updated_at) Return Feature objects filtered by the updated_at column
73: *
74: * @package propel.generator.Thelia.Model.om
75: */
76: abstract class BaseFeatureQuery extends ModelCriteria
77: {
78: /**
79: * Initializes internal state of BaseFeatureQuery object.
80: *
81: * @param string $dbName The dabase name
82: * @param string $modelName The phpName of a model, e.g. 'Book'
83: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
84: */
85: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Feature', $modelAlias = null)
86: {
87: parent::__construct($dbName, $modelName, $modelAlias);
88: }
89:
90: /**
91: * Returns a new FeatureQuery object.
92: *
93: * @param string $modelAlias The alias of a model in the query
94: * @param FeatureQuery|Criteria $criteria Optional Criteria to build the query from
95: *
96: * @return FeatureQuery
97: */
98: public static function create($modelAlias = null, $criteria = null)
99: {
100: if ($criteria instanceof FeatureQuery) {
101: return $criteria;
102: }
103: $query = new FeatureQuery();
104: if (null !== $modelAlias) {
105: $query->setModelAlias($modelAlias);
106: }
107: if ($criteria instanceof Criteria) {
108: $query->mergeWith($criteria);
109: }
110:
111: return $query;
112: }
113:
114: /**
115: * Find object by primary key.
116: * Propel uses the instance pool to skip the database if the object exists.
117: * Go fast if the query is untouched.
118: *
119: * <code>
120: * $obj = $c->findPk(12, $con);
121: * </code>
122: *
123: * @param mixed $key Primary key to use for the query
124: * @param PropelPDO $con an optional connection object
125: *
126: * @return Feature|Feature[]|mixed the result, formatted by the current formatter
127: */
128: public function findPk($key, $con = null)
129: {
130: if ($key === null) {
131: return null;
132: }
133: if ((null !== ($obj = FeaturePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
134: // the object is alredy in the instance pool
135: return $obj;
136: }
137: if ($con === null) {
138: $con = Propel::getConnection(FeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
139: }
140: $this->basePreSelect($con);
141: if ($this->formatter || $this->modelAlias || $this->with || $this->select
142: || $this->selectColumns || $this->asColumns || $this->selectModifiers
143: || $this->map || $this->having || $this->joins) {
144: return $this->findPkComplex($key, $con);
145: } else {
146: return $this->findPkSimple($key, $con);
147: }
148: }
149:
150: /**
151: * Alias of findPk to use instance pooling
152: *
153: * @param mixed $key Primary key to use for the query
154: * @param PropelPDO $con A connection object
155: *
156: * @return Feature A model object, or null if the key is not found
157: * @throws PropelException
158: */
159: public function findOneById($key, $con = null)
160: {
161: return $this->findPk($key, $con);
162: }
163:
164: /**
165: * Find object by primary key using raw SQL to go fast.
166: * Bypass doSelect() and the object formatter by using generated code.
167: *
168: * @param mixed $key Primary key to use for the query
169: * @param PropelPDO $con A connection object
170: *
171: * @return Feature A model object, or null if the key is not found
172: * @throws PropelException
173: */
174: protected function findPkSimple($key, $con)
175: {
176: $sql = 'SELECT `id`, `visible`, `position`, `created_at`, `updated_at` FROM `feature` WHERE `id` = :p0';
177: try {
178: $stmt = $con->prepare($sql);
179: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
180: $stmt->execute();
181: } catch (Exception $e) {
182: Propel::log($e->getMessage(), Propel::LOG_ERR);
183: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
184: }
185: $obj = null;
186: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
187: $obj = new Feature();
188: $obj->hydrate($row);
189: FeaturePeer::addInstanceToPool($obj, (string) $key);
190: }
191: $stmt->closeCursor();
192:
193: return $obj;
194: }
195:
196: /**
197: * Find object by primary key.
198: *
199: * @param mixed $key Primary key to use for the query
200: * @param PropelPDO $con A connection object
201: *
202: * @return Feature|Feature[]|mixed the result, formatted by the current formatter
203: */
204: protected function findPkComplex($key, $con)
205: {
206: // As the query uses a PK condition, no limit(1) is necessary.
207: $criteria = $this->isKeepQuery() ? clone $this : $this;
208: $stmt = $criteria
209: ->filterByPrimaryKey($key)
210: ->doSelect($con);
211:
212: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
213: }
214:
215: /**
216: * Find objects by primary key
217: * <code>
218: * $objs = $c->findPks(array(12, 56, 832), $con);
219: * </code>
220: * @param array $keys Primary keys to use for the query
221: * @param PropelPDO $con an optional connection object
222: *
223: * @return PropelObjectCollection|Feature[]|mixed the list of results, formatted by the current formatter
224: */
225: public function findPks($keys, $con = null)
226: {
227: if ($con === null) {
228: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
229: }
230: $this->basePreSelect($con);
231: $criteria = $this->isKeepQuery() ? clone $this : $this;
232: $stmt = $criteria
233: ->filterByPrimaryKeys($keys)
234: ->doSelect($con);
235:
236: return $criteria->getFormatter()->init($criteria)->format($stmt);
237: }
238:
239: /**
240: * Filter the query by primary key
241: *
242: * @param mixed $key Primary key to use for the query
243: *
244: * @return FeatureQuery The current query, for fluid interface
245: */
246: public function filterByPrimaryKey($key)
247: {
248:
249: return $this->addUsingAlias(FeaturePeer::ID, $key, Criteria::EQUAL);
250: }
251:
252: /**
253: * Filter the query by a list of primary keys
254: *
255: * @param array $keys The list of primary key to use for the query
256: *
257: * @return FeatureQuery The current query, for fluid interface
258: */
259: public function filterByPrimaryKeys($keys)
260: {
261:
262: return $this->addUsingAlias(FeaturePeer::ID, $keys, Criteria::IN);
263: }
264:
265: /**
266: * Filter the query on the id column
267: *
268: * Example usage:
269: * <code>
270: * $query->filterById(1234); // WHERE id = 1234
271: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
272: * $query->filterById(array('min' => 12)); // WHERE id >= 12
273: * $query->filterById(array('max' => 12)); // WHERE id <= 12
274: * </code>
275: *
276: * @param mixed $id The value to use as filter.
277: * Use scalar values for equality.
278: * Use array values for in_array() equivalent.
279: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
280: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
281: *
282: * @return FeatureQuery The current query, for fluid interface
283: */
284: public function filterById($id = null, $comparison = null)
285: {
286: if (is_array($id)) {
287: $useMinMax = false;
288: if (isset($id['min'])) {
289: $this->addUsingAlias(FeaturePeer::ID, $id['min'], Criteria::GREATER_EQUAL);
290: $useMinMax = true;
291: }
292: if (isset($id['max'])) {
293: $this->addUsingAlias(FeaturePeer::ID, $id['max'], Criteria::LESS_EQUAL);
294: $useMinMax = true;
295: }
296: if ($useMinMax) {
297: return $this;
298: }
299: if (null === $comparison) {
300: $comparison = Criteria::IN;
301: }
302: }
303:
304: return $this->addUsingAlias(FeaturePeer::ID, $id, $comparison);
305: }
306:
307: /**
308: * Filter the query on the visible column
309: *
310: * Example usage:
311: * <code>
312: * $query->filterByVisible(1234); // WHERE visible = 1234
313: * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
314: * $query->filterByVisible(array('min' => 12)); // WHERE visible >= 12
315: * $query->filterByVisible(array('max' => 12)); // WHERE visible <= 12
316: * </code>
317: *
318: * @param mixed $visible The value to use as filter.
319: * Use scalar values for equality.
320: * Use array values for in_array() equivalent.
321: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
322: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
323: *
324: * @return FeatureQuery The current query, for fluid interface
325: */
326: public function filterByVisible($visible = null, $comparison = null)
327: {
328: if (is_array($visible)) {
329: $useMinMax = false;
330: if (isset($visible['min'])) {
331: $this->addUsingAlias(FeaturePeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
332: $useMinMax = true;
333: }
334: if (isset($visible['max'])) {
335: $this->addUsingAlias(FeaturePeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
336: $useMinMax = true;
337: }
338: if ($useMinMax) {
339: return $this;
340: }
341: if (null === $comparison) {
342: $comparison = Criteria::IN;
343: }
344: }
345:
346: return $this->addUsingAlias(FeaturePeer::VISIBLE, $visible, $comparison);
347: }
348:
349: /**
350: * Filter the query on the position column
351: *
352: * Example usage:
353: * <code>
354: * $query->filterByPosition(1234); // WHERE position = 1234
355: * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
356: * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
357: * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
358: * </code>
359: *
360: * @param mixed $position The value to use as filter.
361: * Use scalar values for equality.
362: * Use array values for in_array() equivalent.
363: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
364: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
365: *
366: * @return FeatureQuery The current query, for fluid interface
367: */
368: public function filterByPosition($position = null, $comparison = null)
369: {
370: if (is_array($position)) {
371: $useMinMax = false;
372: if (isset($position['min'])) {
373: $this->addUsingAlias(FeaturePeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
374: $useMinMax = true;
375: }
376: if (isset($position['max'])) {
377: $this->addUsingAlias(FeaturePeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
378: $useMinMax = true;
379: }
380: if ($useMinMax) {
381: return $this;
382: }
383: if (null === $comparison) {
384: $comparison = Criteria::IN;
385: }
386: }
387:
388: return $this->addUsingAlias(FeaturePeer::POSITION, $position, $comparison);
389: }
390:
391: /**
392: * Filter the query on the created_at column
393: *
394: * Example usage:
395: * <code>
396: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
397: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
398: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
399: * </code>
400: *
401: * @param mixed $createdAt The value to use as filter.
402: * Values can be integers (unix timestamps), DateTime objects, or strings.
403: * Empty strings are treated as NULL.
404: * Use scalar values for equality.
405: * Use array values for in_array() equivalent.
406: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
407: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
408: *
409: * @return FeatureQuery The current query, for fluid interface
410: */
411: public function filterByCreatedAt($createdAt = null, $comparison = null)
412: {
413: if (is_array($createdAt)) {
414: $useMinMax = false;
415: if (isset($createdAt['min'])) {
416: $this->addUsingAlias(FeaturePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
417: $useMinMax = true;
418: }
419: if (isset($createdAt['max'])) {
420: $this->addUsingAlias(FeaturePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
421: $useMinMax = true;
422: }
423: if ($useMinMax) {
424: return $this;
425: }
426: if (null === $comparison) {
427: $comparison = Criteria::IN;
428: }
429: }
430:
431: return $this->addUsingAlias(FeaturePeer::CREATED_AT, $createdAt, $comparison);
432: }
433:
434: /**
435: * Filter the query on the updated_at column
436: *
437: * Example usage:
438: * <code>
439: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
440: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
441: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
442: * </code>
443: *
444: * @param mixed $updatedAt The value to use as filter.
445: * Values can be integers (unix timestamps), DateTime objects, or strings.
446: * Empty strings are treated as NULL.
447: * Use scalar values for equality.
448: * Use array values for in_array() equivalent.
449: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
450: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
451: *
452: * @return FeatureQuery The current query, for fluid interface
453: */
454: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
455: {
456: if (is_array($updatedAt)) {
457: $useMinMax = false;
458: if (isset($updatedAt['min'])) {
459: $this->addUsingAlias(FeaturePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
460: $useMinMax = true;
461: }
462: if (isset($updatedAt['max'])) {
463: $this->addUsingAlias(FeaturePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
464: $useMinMax = true;
465: }
466: if ($useMinMax) {
467: return $this;
468: }
469: if (null === $comparison) {
470: $comparison = Criteria::IN;
471: }
472: }
473:
474: return $this->addUsingAlias(FeaturePeer::UPDATED_AT, $updatedAt, $comparison);
475: }
476:
477: /**
478: * Filter the query by a related FeatureAv object
479: *
480: * @param FeatureAv|PropelObjectCollection $featureAv the related object to use as filter
481: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
482: *
483: * @return FeatureQuery The current query, for fluid interface
484: * @throws PropelException - if the provided filter is invalid.
485: */
486: public function filterByFeatureAv($featureAv, $comparison = null)
487: {
488: if ($featureAv instanceof FeatureAv) {
489: return $this
490: ->addUsingAlias(FeaturePeer::ID, $featureAv->getFeatureId(), $comparison);
491: } elseif ($featureAv instanceof PropelObjectCollection) {
492: return $this
493: ->useFeatureAvQuery()
494: ->filterByPrimaryKeys($featureAv->getPrimaryKeys())
495: ->endUse();
496: } else {
497: throw new PropelException('filterByFeatureAv() only accepts arguments of type FeatureAv or PropelCollection');
498: }
499: }
500:
501: /**
502: * Adds a JOIN clause to the query using the FeatureAv relation
503: *
504: * @param string $relationAlias optional alias for the relation
505: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
506: *
507: * @return FeatureQuery The current query, for fluid interface
508: */
509: public function joinFeatureAv($relationAlias = null, $joinType = Criteria::INNER_JOIN)
510: {
511: $tableMap = $this->getTableMap();
512: $relationMap = $tableMap->getRelation('FeatureAv');
513:
514: // create a ModelJoin object for this join
515: $join = new ModelJoin();
516: $join->setJoinType($joinType);
517: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
518: if ($previousJoin = $this->getPreviousJoin()) {
519: $join->setPreviousJoin($previousJoin);
520: }
521:
522: // add the ModelJoin to the current object
523: if ($relationAlias) {
524: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
525: $this->addJoinObject($join, $relationAlias);
526: } else {
527: $this->addJoinObject($join, 'FeatureAv');
528: }
529:
530: return $this;
531: }
532:
533: /**
534: * Use the FeatureAv relation FeatureAv object
535: *
536: * @see useQuery()
537: *
538: * @param string $relationAlias optional alias for the relation,
539: * to be used as main alias in the secondary query
540: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
541: *
542: * @return \Thelia\Model\FeatureAvQuery A secondary query class using the current class as primary query
543: */
544: public function useFeatureAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
545: {
546: return $this
547: ->joinFeatureAv($relationAlias, $joinType)
548: ->useQuery($relationAlias ? $relationAlias : 'FeatureAv', '\Thelia\Model\FeatureAvQuery');
549: }
550:
551: /**
552: * Filter the query by a related FeatureProd object
553: *
554: * @param FeatureProd|PropelObjectCollection $featureProd the related object to use as filter
555: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
556: *
557: * @return FeatureQuery The current query, for fluid interface
558: * @throws PropelException - if the provided filter is invalid.
559: */
560: public function filterByFeatureProd($featureProd, $comparison = null)
561: {
562: if ($featureProd instanceof FeatureProd) {
563: return $this
564: ->addUsingAlias(FeaturePeer::ID, $featureProd->getFeatureId(), $comparison);
565: } elseif ($featureProd instanceof PropelObjectCollection) {
566: return $this
567: ->useFeatureProdQuery()
568: ->filterByPrimaryKeys($featureProd->getPrimaryKeys())
569: ->endUse();
570: } else {
571: throw new PropelException('filterByFeatureProd() only accepts arguments of type FeatureProd or PropelCollection');
572: }
573: }
574:
575: /**
576: * Adds a JOIN clause to the query using the FeatureProd relation
577: *
578: * @param string $relationAlias optional alias for the relation
579: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
580: *
581: * @return FeatureQuery The current query, for fluid interface
582: */
583: public function joinFeatureProd($relationAlias = null, $joinType = Criteria::INNER_JOIN)
584: {
585: $tableMap = $this->getTableMap();
586: $relationMap = $tableMap->getRelation('FeatureProd');
587:
588: // create a ModelJoin object for this join
589: $join = new ModelJoin();
590: $join->setJoinType($joinType);
591: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
592: if ($previousJoin = $this->getPreviousJoin()) {
593: $join->setPreviousJoin($previousJoin);
594: }
595:
596: // add the ModelJoin to the current object
597: if ($relationAlias) {
598: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
599: $this->addJoinObject($join, $relationAlias);
600: } else {
601: $this->addJoinObject($join, 'FeatureProd');
602: }
603:
604: return $this;
605: }
606:
607: /**
608: * Use the FeatureProd relation FeatureProd object
609: *
610: * @see useQuery()
611: *
612: * @param string $relationAlias optional alias for the relation,
613: * to be used as main alias in the secondary query
614: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
615: *
616: * @return \Thelia\Model\FeatureProdQuery A secondary query class using the current class as primary query
617: */
618: public function useFeatureProdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
619: {
620: return $this
621: ->joinFeatureProd($relationAlias, $joinType)
622: ->useQuery($relationAlias ? $relationAlias : 'FeatureProd', '\Thelia\Model\FeatureProdQuery');
623: }
624:
625: /**
626: * Filter the query by a related FeatureCategory object
627: *
628: * @param FeatureCategory|PropelObjectCollection $featureCategory the related object to use as filter
629: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
630: *
631: * @return FeatureQuery The current query, for fluid interface
632: * @throws PropelException - if the provided filter is invalid.
633: */
634: public function filterByFeatureCategory($featureCategory, $comparison = null)
635: {
636: if ($featureCategory instanceof FeatureCategory) {
637: return $this
638: ->addUsingAlias(FeaturePeer::ID, $featureCategory->getFeatureId(), $comparison);
639: } elseif ($featureCategory instanceof PropelObjectCollection) {
640: return $this
641: ->useFeatureCategoryQuery()
642: ->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
643: ->endUse();
644: } else {
645: throw new PropelException('filterByFeatureCategory() only accepts arguments of type FeatureCategory or PropelCollection');
646: }
647: }
648:
649: /**
650: * Adds a JOIN clause to the query using the FeatureCategory relation
651: *
652: * @param string $relationAlias optional alias for the relation
653: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
654: *
655: * @return FeatureQuery The current query, for fluid interface
656: */
657: public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
658: {
659: $tableMap = $this->getTableMap();
660: $relationMap = $tableMap->getRelation('FeatureCategory');
661:
662: // create a ModelJoin object for this join
663: $join = new ModelJoin();
664: $join->setJoinType($joinType);
665: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
666: if ($previousJoin = $this->getPreviousJoin()) {
667: $join->setPreviousJoin($previousJoin);
668: }
669:
670: // add the ModelJoin to the current object
671: if ($relationAlias) {
672: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
673: $this->addJoinObject($join, $relationAlias);
674: } else {
675: $this->addJoinObject($join, 'FeatureCategory');
676: }
677:
678: return $this;
679: }
680:
681: /**
682: * Use the FeatureCategory relation FeatureCategory object
683: *
684: * @see useQuery()
685: *
686: * @param string $relationAlias optional alias for the relation,
687: * to be used as main alias in the secondary query
688: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
689: *
690: * @return \Thelia\Model\FeatureCategoryQuery A secondary query class using the current class as primary query
691: */
692: public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
693: {
694: return $this
695: ->joinFeatureCategory($relationAlias, $joinType)
696: ->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
697: }
698:
699: /**
700: * Filter the query by a related FeatureI18n object
701: *
702: * @param FeatureI18n|PropelObjectCollection $featureI18n the related object to use as filter
703: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
704: *
705: * @return FeatureQuery The current query, for fluid interface
706: * @throws PropelException - if the provided filter is invalid.
707: */
708: public function filterByFeatureI18n($featureI18n, $comparison = null)
709: {
710: if ($featureI18n instanceof FeatureI18n) {
711: return $this
712: ->addUsingAlias(FeaturePeer::ID, $featureI18n->getId(), $comparison);
713: } elseif ($featureI18n instanceof PropelObjectCollection) {
714: return $this
715: ->useFeatureI18nQuery()
716: ->filterByPrimaryKeys($featureI18n->getPrimaryKeys())
717: ->endUse();
718: } else {
719: throw new PropelException('filterByFeatureI18n() only accepts arguments of type FeatureI18n or PropelCollection');
720: }
721: }
722:
723: /**
724: * Adds a JOIN clause to the query using the FeatureI18n relation
725: *
726: * @param string $relationAlias optional alias for the relation
727: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
728: *
729: * @return FeatureQuery The current query, for fluid interface
730: */
731: public function joinFeatureI18n($relationAlias = null, $joinType = 'LEFT JOIN')
732: {
733: $tableMap = $this->getTableMap();
734: $relationMap = $tableMap->getRelation('FeatureI18n');
735:
736: // create a ModelJoin object for this join
737: $join = new ModelJoin();
738: $join->setJoinType($joinType);
739: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
740: if ($previousJoin = $this->getPreviousJoin()) {
741: $join->setPreviousJoin($previousJoin);
742: }
743:
744: // add the ModelJoin to the current object
745: if ($relationAlias) {
746: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
747: $this->addJoinObject($join, $relationAlias);
748: } else {
749: $this->addJoinObject($join, 'FeatureI18n');
750: }
751:
752: return $this;
753: }
754:
755: /**
756: * Use the FeatureI18n relation FeatureI18n object
757: *
758: * @see useQuery()
759: *
760: * @param string $relationAlias optional alias for the relation,
761: * to be used as main alias in the secondary query
762: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
763: *
764: * @return \Thelia\Model\FeatureI18nQuery A secondary query class using the current class as primary query
765: */
766: public function useFeatureI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
767: {
768: return $this
769: ->joinFeatureI18n($relationAlias, $joinType)
770: ->useQuery($relationAlias ? $relationAlias : 'FeatureI18n', '\Thelia\Model\FeatureI18nQuery');
771: }
772:
773: /**
774: * Exclude object from result
775: *
776: * @param Feature $feature Object to remove from the list of results
777: *
778: * @return FeatureQuery The current query, for fluid interface
779: */
780: public function prune($feature = null)
781: {
782: if ($feature) {
783: $this->addUsingAlias(FeaturePeer::ID, $feature->getId(), Criteria::NOT_EQUAL);
784: }
785:
786: return $this;
787: }
788:
789: // timestampable behavior
790:
791: /**
792: * Filter by the latest updated
793: *
794: * @param int $nbDays Maximum age of the latest update in days
795: *
796: * @return FeatureQuery The current query, for fluid interface
797: */
798: public function recentlyUpdated($nbDays = 7)
799: {
800: return $this->addUsingAlias(FeaturePeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
801: }
802:
803: /**
804: * Order by update date desc
805: *
806: * @return FeatureQuery The current query, for fluid interface
807: */
808: public function lastUpdatedFirst()
809: {
810: return $this->addDescendingOrderByColumn(FeaturePeer::UPDATED_AT);
811: }
812:
813: /**
814: * Order by update date asc
815: *
816: * @return FeatureQuery The current query, for fluid interface
817: */
818: public function firstUpdatedFirst()
819: {
820: return $this->addAscendingOrderByColumn(FeaturePeer::UPDATED_AT);
821: }
822:
823: /**
824: * Filter by the latest created
825: *
826: * @param int $nbDays Maximum age of in days
827: *
828: * @return FeatureQuery The current query, for fluid interface
829: */
830: public function recentlyCreated($nbDays = 7)
831: {
832: return $this->addUsingAlias(FeaturePeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
833: }
834:
835: /**
836: * Order by create date desc
837: *
838: * @return FeatureQuery The current query, for fluid interface
839: */
840: public function lastCreatedFirst()
841: {
842: return $this->addDescendingOrderByColumn(FeaturePeer::CREATED_AT);
843: }
844:
845: /**
846: * Order by create date asc
847: *
848: * @return FeatureQuery The current query, for fluid interface
849: */
850: public function firstCreatedFirst()
851: {
852: return $this->addAscendingOrderByColumn(FeaturePeer::CREATED_AT);
853: }
854: // i18n behavior
855:
856: /**
857: * Adds a JOIN clause to the query using the i18n relation
858: *
859: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
860: * @param string $relationAlias optional alias for the relation
861: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
862: *
863: * @return FeatureQuery The current query, for fluid interface
864: */
865: public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
866: {
867: $relationName = $relationAlias ? $relationAlias : 'FeatureI18n';
868:
869: return $this
870: ->joinFeatureI18n($relationAlias, $joinType)
871: ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
872: }
873:
874: /**
875: * Adds a JOIN clause to the query and hydrates the related I18n object.
876: * Shortcut for $c->joinI18n($locale)->with()
877: *
878: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
879: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
880: *
881: * @return FeatureQuery The current query, for fluid interface
882: */
883: public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
884: {
885: $this
886: ->joinI18n($locale, null, $joinType)
887: ->with('FeatureI18n');
888: $this->with['FeatureI18n']->setIsWithOneToMany(false);
889:
890: return $this;
891: }
892:
893: /**
894: * Use the I18n relation query object
895: *
896: * @see useQuery()
897: *
898: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
899: * @param string $relationAlias optional alias for the relation
900: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
901: *
902: * @return FeatureI18nQuery A secondary query class using the current class as primary query
903: */
904: public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
905: {
906: return $this
907: ->joinI18n($locale, $relationAlias, $joinType)
908: ->useQuery($relationAlias ? $relationAlias : 'FeatureI18n', 'Thelia\Model\FeatureI18nQuery');
909: }
910:
911: }
912: