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