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