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