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