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