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