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