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