# File core/lib/Thelia/Model/om/BaseGroupModuleQuery.php | thelia

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