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