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