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