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