      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\Area;
     16: use Thelia\Model\Country;
     17: use Thelia\Model\CountryI18n;
     18: use Thelia\Model\CountryPeer;
     19: use Thelia\Model\CountryQuery;
     20: use Thelia\Model\TaxRuleCountry;
     21:
     22: /**
     23:  * Base class that represents a query for the 'country' table.
     24:  *
     25:  *
     26:  *
     27:  * @method CountryQuery orderById($order = Criteria::ASC) Order by the id column
     28:  * @method CountryQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
     29:  * @method CountryQuery orderByIsocode($order = Criteria::ASC) Order by the isocode column
     30:  * @method CountryQuery orderByIsoalpha2($order = Criteria::ASC) Order by the isoalpha2 column
     31:  * @method CountryQuery orderByIsoalpha3($order = Criteria::ASC) Order by the isoalpha3 column
     32:  * @method CountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     33:  * @method CountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     34:  *
     35:  * @method CountryQuery groupById() Group by the id column
     36:  * @method CountryQuery groupByAreaId() Group by the area_id column
     37:  * @method CountryQuery groupByIsocode() Group by the isocode column
     38:  * @method CountryQuery groupByIsoalpha2() Group by the isoalpha2 column
     39:  * @method CountryQuery groupByIsoalpha3() Group by the isoalpha3 column
     40:  * @method CountryQuery groupByCreatedAt() Group by the created_at column
     41:  * @method CountryQuery groupByUpdatedAt() Group by the updated_at column
     42:  *
     43:  * @method CountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     44:  * @method CountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     45:  * @method CountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     46:  *
     47:  * @method CountryQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
     48:  * @method CountryQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
     49:  * @method CountryQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
     50:  *
     51:  * @method CountryQuery leftJoinTaxRuleCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleCountry relation
     52:  * @method CountryQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
     53:  * @method CountryQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
     54:  *
     55:  * @method CountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
     56:  * @method CountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
     57:  * @method CountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
     58:  *
     59:  * @method Country findOne(PropelPDO $con = null) Return the first Country matching the query
     60:  * @method Country findOneOrCreate(PropelPDO $con = null) Return the first Country matching the query, or a new Country object populated from the query conditions when no match is found
     61:  *
     62:  * @method Country findOneByAreaId(int $area_id) Return the first Country filtered by the area_id column
     63:  * @method Country findOneByIsocode(string $isocode) Return the first Country filtered by the isocode column
     64:  * @method Country findOneByIsoalpha2(string $isoalpha2) Return the first Country filtered by the isoalpha2 column
     65:  * @method Country findOneByIsoalpha3(string $isoalpha3) Return the first Country filtered by the isoalpha3 column
     66:  * @method Country findOneByCreatedAt(string $created_at) Return the first Country filtered by the created_at column
     67:  * @method Country findOneByUpdatedAt(string $updated_at) Return the first Country filtered by the updated_at column
     68:  *
     69:  * @method array findById(int $id) Return Country objects filtered by the id column
     70:  * @method array findByAreaId(int $area_id) Return Country objects filtered by the area_id column
     71:  * @method array findByIsocode(string $isocode) Return Country objects filtered by the isocode column
     72:  * @method array findByIsoalpha2(string $isoalpha2) Return Country objects filtered by the isoalpha2 column
     73:  * @method array findByIsoalpha3(string $isoalpha3) Return Country objects filtered by the isoalpha3 column
     74:  * @method array findByCreatedAt(string $created_at) Return Country objects filtered by the created_at column
     75:  * @method array findByUpdatedAt(string $updated_at) Return Country objects filtered by the updated_at column
     76:  *
     77:  * @package    propel.generator.Thelia.Model.om
     78:  */
     79: abstract class BaseCountryQuery extends ModelCriteria
     80: {
     81:     /**
     82:      * Initializes internal state of BaseCountryQuery 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\\Country', $modelAlias = null)
     89:     {
     90:         parent::__construct($dbName, $modelName, $modelAlias);
     91:     }
     92:
     93:     /**
     94:      * Returns a new CountryQuery object.
     95:      *
     96:      * @param     string $modelAlias The alias of a model in the query
     97:      * @param   CountryQuery|Criteria $criteria Optional Criteria to build the query from
     98:      *
     99:      * @return CountryQuery
    100:      */
    101:     public static function create($modelAlias = null, $criteria = null)
    102:     {
    103:         if ($criteria instanceof CountryQuery) {
    104:             return $criteria;
    105:         }
    106:         $query = new CountryQuery();
    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   Country|Country[]|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 = CountryPeer::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(CountryPeer::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                 Country 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                 Country 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`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at` FROM `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 Country();
    191:             $obj->hydrate($row);
    192:             CountryPeer::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 Country|Country[]|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|Country[]|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 CountryQuery The current query, for fluid interface
    248:      */
    249:     public function filterByPrimaryKey($key)
    250:     {
    251:
    252:         return $this->addUsingAlias(CountryPeer::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 CountryQuery The current query, for fluid interface
    261:      */
    262:     public function filterByPrimaryKeys($keys)
    263:     {
    264:
    265:         return $this->addUsingAlias(CountryPeer::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 CountryQuery 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(CountryPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
    293:                 $useMinMax = true;
    294:             }
    295:             if (isset($id['max'])) {
    296:                 $this->addUsingAlias(CountryPeer::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(CountryPeer::ID, $id, $comparison);
    308:     }
    309:
    310:     /**
    311:      * Filter the query on the area_id column
    312:      *
    313:      * Example usage:
    314:      * <code>
    315:      * $query->filterByAreaId(1234); // WHERE area_id = 1234
    316:      * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
    317:      * $query->filterByAreaId(array('min' => 12)); // WHERE area_id >= 12
    318:      * $query->filterByAreaId(array('max' => 12)); // WHERE area_id <= 12
    319:      * </code>
    320:      *
    321:      * @see       filterByArea()
    322:      *
    323:      * @param     mixed $areaId 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 CountryQuery The current query, for fluid interface
    330:      */
    331:     public function filterByAreaId($areaId = null, $comparison = null)
    332:     {
    333:         if (is_array($areaId)) {
    334:             $useMinMax = false;
    335:             if (isset($areaId['min'])) {
    336:                 $this->addUsingAlias(CountryPeer::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
    337:                 $useMinMax = true;
    338:             }
    339:             if (isset($areaId['max'])) {
    340:                 $this->addUsingAlias(CountryPeer::AREA_ID, $areaId['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(CountryPeer::AREA_ID, $areaId, $comparison);
    352:     }
    353:
    354:     /**
    355:      * Filter the query on the isocode column
    356:      *
    357:      * Example usage:
    358:      * <code>
    359:      * $query->filterByIsocode('fooValue');   // WHERE isocode = 'fooValue'
    360:      * $query->filterByIsocode('%fooValue%'); // WHERE isocode LIKE '%fooValue%'
    361:      * </code>
    362:      *
    363:      * @param     string $isocode The value to use as filter.
    364:      *              Accepts wildcards (* and % trigger a LIKE)
    365:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    366:      *
    367:      * @return CountryQuery The current query, for fluid interface
    368:      */
    369:     public function filterByIsocode($isocode = null, $comparison = null)
    370:     {
    371:         if (null === $comparison) {
    372:             if (is_array($isocode)) {
    373:                 $comparison = Criteria::IN;
    374:             } elseif (preg_match('/[\%\*]/', $isocode)) {
    375:                 $isocode = str_replace('*', '%', $isocode);
    376:                 $comparison = Criteria::LIKE;
    377:             }
    378:         }
    379:
    380:         return $this->addUsingAlias(CountryPeer::ISOCODE, $isocode, $comparison);
    381:     }
    382:
    383:     /**
    384:      * Filter the query on the isoalpha2 column
    385:      *
    386:      * Example usage:
    387:      * <code>
    388:      * $query->filterByIsoalpha2('fooValue');   // WHERE isoalpha2 = 'fooValue'
    389:      * $query->filterByIsoalpha2('%fooValue%'); // WHERE isoalpha2 LIKE '%fooValue%'
    390:      * </code>
    391:      *
    392:      * @param     string $isoalpha2 The value to use as filter.
    393:      *              Accepts wildcards (* and % trigger a LIKE)
    394:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    395:      *
    396:      * @return CountryQuery The current query, for fluid interface
    397:      */
    398:     public function filterByIsoalpha2($isoalpha2 = null, $comparison = null)
    399:     {
    400:         if (null === $comparison) {
    401:             if (is_array($isoalpha2)) {
    402:                 $comparison = Criteria::IN;
    403:             } elseif (preg_match('/[\%\*]/', $isoalpha2)) {
    404:                 $isoalpha2 = str_replace('*', '%', $isoalpha2);
    405:                 $comparison = Criteria::LIKE;
    406:             }
    407:         }
    408:
    409:         return $this->addUsingAlias(CountryPeer::ISOALPHA2, $isoalpha2, $comparison);
    410:     }
    411:
    412:     /**
    413:      * Filter the query on the isoalpha3 column
    414:      *
    415:      * Example usage:
    416:      * <code>
    417:      * $query->filterByIsoalpha3('fooValue');   // WHERE isoalpha3 = 'fooValue'
    418:      * $query->filterByIsoalpha3('%fooValue%'); // WHERE isoalpha3 LIKE '%fooValue%'
    419:      * </code>
    420:      *
    421:      * @param     string $isoalpha3 The value to use as filter.
    422:      *              Accepts wildcards (* and % trigger a LIKE)
    423:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    424:      *
    425:      * @return CountryQuery The current query, for fluid interface
    426:      */
    427:     public function filterByIsoalpha3($isoalpha3 = null, $comparison = null)
    428:     {
    429:         if (null === $comparison) {
    430:             if (is_array($isoalpha3)) {
    431:                 $comparison = Criteria::IN;
    432:             } elseif (preg_match('/[\%\*]/', $isoalpha3)) {
    433:                 $isoalpha3 = str_replace('*', '%', $isoalpha3);
    434:                 $comparison = Criteria::LIKE;
    435:             }
    436:         }
    437:
    438:         return $this->addUsingAlias(CountryPeer::ISOALPHA3, $isoalpha3, $comparison);
    439:     }
    440:
    441:     /**
    442:      * Filter the query on the created_at column
    443:      *
    444:      * Example usage:
    445:      * <code>
    446:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    447:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    448:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    449:      * </code>
    450:      *
    451:      * @param     mixed $createdAt The value to use as filter.
    452:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    453:      *              Empty strings are treated as NULL.
    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 CountryQuery The current query, for fluid interface
    460:      */
    461:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    462:     {
    463:         if (is_array($createdAt)) {
    464:             $useMinMax = false;
    465:             if (isset($createdAt['min'])) {
    466:                 $this->addUsingAlias(CountryPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    467:                 $useMinMax = true;
    468:             }
    469:             if (isset($createdAt['max'])) {
    470:                 $this->addUsingAlias(CountryPeer::CREATED_AT, $createdAt['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(CountryPeer::CREATED_AT, $createdAt, $comparison);
    482:     }
    483:
    484:     /**
    485:      * Filter the query on the updated_at column
    486:      *
    487:      * Example usage:
    488:      * <code>
    489:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    490:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    491:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    492:      * </code>
    493:      *
    494:      * @param     mixed $updatedAt 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 CountryQuery The current query, for fluid interface
    503:      */
    504:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    505:     {
    506:         if (is_array($updatedAt)) {
    507:             $useMinMax = false;
    508:             if (isset($updatedAt['min'])) {
    509:                 $this->addUsingAlias(CountryPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    510:                 $useMinMax = true;
    511:             }
    512:             if (isset($updatedAt['max'])) {
    513:                 $this->addUsingAlias(CountryPeer::UPDATED_AT, $updatedAt['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(CountryPeer::UPDATED_AT, $updatedAt, $comparison);
    525:     }
    526:
    527:     /**
    528:      * Filter the query by a related Area object
    529:      *
    530:      * @param   Area|PropelObjectCollection $area The related object(s) to use as filter
    531:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    532:      *
    533:      * @return                 CountryQuery The current query, for fluid interface
    534:      * @throws PropelException - if the provided filter is invalid.
    535:      */
    536:     public function filterByArea($area, $comparison = null)
    537:     {
    538:         if ($area instanceof Area) {
    539:             return $this
    540:                 ->addUsingAlias(CountryPeer::AREA_ID, $area->getId(), $comparison);
    541:         } elseif ($area instanceof PropelObjectCollection) {
    542:             if (null === $comparison) {
    543:                 $comparison = Criteria::IN;
    544:             }
    545:
    546:             return $this
    547:                 ->addUsingAlias(CountryPeer::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
    548:         } else {
    549:             throw new PropelException('filterByArea() only accepts arguments of type Area or PropelCollection');
    550:         }
    551:     }
    552:
    553:     /**
    554:      * Adds a JOIN clause to the query using the Area relation
    555:      *
    556:      * @param     string $relationAlias optional alias for the relation
    557:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    558:      *
    559:      * @return CountryQuery The current query, for fluid interface
    560:      */
    561:     public function joinArea($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    562:     {
    563:         $tableMap = $this->getTableMap();
    564:         $relationMap = $tableMap->getRelation('Area');
    565:
    566:         // create a ModelJoin object for this join
    567:         $join = new ModelJoin();
    568:         $join->setJoinType($joinType);
    569:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    570:         if ($previousJoin = $this->getPreviousJoin()) {
    571:             $join->setPreviousJoin($previousJoin);
    572:         }
    573:
    574:         // add the ModelJoin to the current object
    575:         if ($relationAlias) {
    576:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    577:             $this->addJoinObject($join, $relationAlias);
    578:         } else {
    579:             $this->addJoinObject($join, 'Area');
    580:         }
    581:
    582:         return $this;
    583:     }
    584:
    585:     /**
    586:      * Use the Area relation Area object
    587:      *
    588:      * @see       useQuery()
    589:      *
    590:      * @param     string $relationAlias optional alias for the relation,
    591:      *                                   to be used as main alias in the secondary query
    592:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    593:      *
    594:      * @return   \Thelia\Model\AreaQuery A secondary query class using the current class as primary query
    595:      */
    596:     public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    597:     {
    598:         return $this
    599:             ->joinArea($relationAlias, $joinType)
    600:             ->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
    601:     }
    602:
    603:     /**
    604:      * Filter the query by a related TaxRuleCountry object
    605:      *
    606:      * @param   TaxRuleCountry|PropelObjectCollection $taxRuleCountry  the related object to use as filter
    607:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    608:      *
    609:      * @return                 CountryQuery The current query, for fluid interface
    610:      * @throws PropelException - if the provided filter is invalid.
    611:      */
    612:     public function filterByTaxRuleCountry($taxRuleCountry, $comparison = null)
    613:     {
    614:         if ($taxRuleCountry instanceof TaxRuleCountry) {
    615:             return $this
    616:                 ->addUsingAlias(CountryPeer::ID, $taxRuleCountry->getCountryId(), $comparison);
    617:         } elseif ($taxRuleCountry instanceof PropelObjectCollection) {
    618:             return $this
    619:                 ->useTaxRuleCountryQuery()
    620:                 ->filterByPrimaryKeys($taxRuleCountry->getPrimaryKeys())
    621:                 ->endUse();
    622:         } else {
    623:             throw new PropelException('filterByTaxRuleCountry() only accepts arguments of type TaxRuleCountry or PropelCollection');
    624:         }
    625:     }
    626:
    627:     /**
    628:      * Adds a JOIN clause to the query using the TaxRuleCountry relation
    629:      *
    630:      * @param     string $relationAlias optional alias for the relation
    631:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    632:      *
    633:      * @return CountryQuery The current query, for fluid interface
    634:      */
    635:     public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    636:     {
    637:         $tableMap = $this->getTableMap();
    638:         $relationMap = $tableMap->getRelation('TaxRuleCountry');
    639:
    640:         // create a ModelJoin object for this join
    641:         $join = new ModelJoin();
    642:         $join->setJoinType($joinType);
    643:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    644:         if ($previousJoin = $this->getPreviousJoin()) {
    645:             $join->setPreviousJoin($previousJoin);
    646:         }
    647:
    648:         // add the ModelJoin to the current object
    649:         if ($relationAlias) {
    650:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    651:             $this->addJoinObject($join, $relationAlias);
    652:         } else {
    653:             $this->addJoinObject($join, 'TaxRuleCountry');
    654:         }
    655:
    656:         return $this;
    657:     }
    658:
    659:     /**
    660:      * Use the TaxRuleCountry relation TaxRuleCountry object
    661:      *
    662:      * @see       useQuery()
    663:      *
    664:      * @param     string $relationAlias optional alias for the relation,
    665:      *                                   to be used as main alias in the secondary query
    666:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    667:      *
    668:      * @return   \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query
    669:      */
    670:     public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    671:     {
    672:         return $this
    673:             ->joinTaxRuleCountry($relationAlias, $joinType)
    674:             ->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
    675:     }
    676:
    677:     /**
    678:      * Filter the query by a related CountryI18n object
    679:      *
    680:      * @param   CountryI18n|PropelObjectCollection $countryI18n  the related object to use as filter
    681:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    682:      *
    683:      * @return                 CountryQuery The current query, for fluid interface
    684:      * @throws PropelException - if the provided filter is invalid.
    685:      */
    686:     public function filterByCountryI18n($countryI18n, $comparison = null)
    687:     {
    688:         if ($countryI18n instanceof CountryI18n) {
    689:             return $this
    690:                 ->addUsingAlias(CountryPeer::ID, $countryI18n->getId(), $comparison);
    691:         } elseif ($countryI18n instanceof PropelObjectCollection) {
    692:             return $this
    693:                 ->useCountryI18nQuery()
    694:                 ->filterByPrimaryKeys($countryI18n->getPrimaryKeys())
    695:                 ->endUse();
    696:         } else {
    697:             throw new PropelException('filterByCountryI18n() only accepts arguments of type CountryI18n or PropelCollection');
    698:         }
    699:     }
    700:
    701:     /**
    702:      * Adds a JOIN clause to the query using the CountryI18n relation
    703:      *
    704:      * @param     string $relationAlias optional alias for the relation
    705:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    706:      *
    707:      * @return CountryQuery The current query, for fluid interface
    708:      */
    709:     public function joinCountryI18n($relationAlias = null, $joinType = 'LEFT JOIN')
    710:     {
    711:         $tableMap = $this->getTableMap();
    712:         $relationMap = $tableMap->getRelation('CountryI18n');
    713:
    714:         // create a ModelJoin object for this join
    715:         $join = new ModelJoin();
    716:         $join->setJoinType($joinType);
    717:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    718:         if ($previousJoin = $this->getPreviousJoin()) {
    719:             $join->setPreviousJoin($previousJoin);
    720:         }
    721:
    722:         // add the ModelJoin to the current object
    723:         if ($relationAlias) {
    724:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    725:             $this->addJoinObject($join, $relationAlias);
    726:         } else {
    727:             $this->addJoinObject($join, 'CountryI18n');
    728:         }
    729:
    730:         return $this;
    731:     }
    732:
    733:     /**
    734:      * Use the CountryI18n relation CountryI18n object
    735:      *
    736:      * @see       useQuery()
    737:      *
    738:      * @param     string $relationAlias optional alias for the relation,
    739:      *                                   to be used as main alias in the secondary query
    740:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    741:      *
    742:      * @return   \Thelia\Model\CountryI18nQuery A secondary query class using the current class as primary query
    743:      */
    744:     public function useCountryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
    745:     {
    746:         return $this
    747:             ->joinCountryI18n($relationAlias, $joinType)
    748:             ->useQuery($relationAlias ? $relationAlias : 'CountryI18n', '\Thelia\Model\CountryI18nQuery');
    749:     }
    750:
    751:     /**
    752:      * Exclude object from result
    753:      *
    754:      * @param   Country $country Object to remove from the list of results
    755:      *
    756:      * @return CountryQuery The current query, for fluid interface
    757:      */
    758:     public function prune($country = null)
    759:     {
    760:         if ($country) {
    761:             $this->addUsingAlias(CountryPeer::ID, $country->getId(), Criteria::NOT_EQUAL);
    762:         }
    763:
    764:         return $this;
    765:     }
    766:
    767:     // timestampable behavior
    768:
    769:     /**
    770:      * Filter by the latest updated
    771:      *
    772:      * @param      int $nbDays Maximum age of the latest update in days
    773:      *
    774:      * @return     CountryQuery The current query, for fluid interface
    775:      */
    776:     public function recentlyUpdated($nbDays = 7)
    777:     {
    778:         return $this->addUsingAlias(CountryPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    779:     }
    780:
    781:     /**
    782:      * Order by update date desc
    783:      *
    784:      * @return     CountryQuery The current query, for fluid interface
    785:      */
    786:     public function lastUpdatedFirst()
    787:     {
    788:         return $this->addDescendingOrderByColumn(CountryPeer::UPDATED_AT);
    789:     }
    790:
    791:     /**
    792:      * Order by update date asc
    793:      *
    794:      * @return     CountryQuery The current query, for fluid interface
    795:      */
    796:     public function firstUpdatedFirst()
    797:     {
    798:         return $this->addAscendingOrderByColumn(CountryPeer::UPDATED_AT);
    799:     }
    800:
    801:     /**
    802:      * Filter by the latest created
    803:      *
    804:      * @param      int $nbDays Maximum age of in days
    805:      *
    806:      * @return     CountryQuery The current query, for fluid interface
    807:      */
    808:     public function recentlyCreated($nbDays = 7)
    809:     {
    810:         return $this->addUsingAlias(CountryPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    811:     }
    812:
    813:     /**
    814:      * Order by create date desc
    815:      *
    816:      * @return     CountryQuery The current query, for fluid interface
    817:      */
    818:     public function lastCreatedFirst()
    819:     {
    820:         return $this->addDescendingOrderByColumn(CountryPeer::CREATED_AT);
    821:     }
    822:
    823:     /**
    824:      * Order by create date asc
    825:      *
    826:      * @return     CountryQuery The current query, for fluid interface
    827:      */
    828:     public function firstCreatedFirst()
    829:     {
    830:         return $this->addAscendingOrderByColumn(CountryPeer::CREATED_AT);
    831:     }
    832:     // i18n behavior
    833:
    834:     /**
    835:      * Adds a JOIN clause to the query using the i18n relation
    836:      *
    837:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    838:      * @param     string $relationAlias optional alias for the relation
    839:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    840:      *
    841:      * @return    CountryQuery The current query, for fluid interface
    842:      */
    843:     public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    844:     {
    845:         $relationName = $relationAlias ? $relationAlias : 'CountryI18n';
    846:
    847:         return $this
    848:             ->joinCountryI18n($relationAlias, $joinType)
    849:             ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
    850:     }
    851:
    852:     /**
    853:      * Adds a JOIN clause to the query and hydrates the related I18n object.
    854:      * Shortcut for $c->joinI18n($locale)->with()
    855:      *
    856:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    857:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    858:      *
    859:      * @return    CountryQuery The current query, for fluid interface
    860:      */
    861:     public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
    862:     {
    863:         $this
    864:             ->joinI18n($locale, null, $joinType)
    865:             ->with('CountryI18n');
    866:         $this->with['CountryI18n']->setIsWithOneToMany(false);
    867:
    868:         return $this;
    869:     }
    870:
    871:     /**
    872:      * Use the I18n relation query object
    873:      *
    874:      * @see       useQuery()
    875:      *
    876:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    877:      * @param     string $relationAlias optional alias for the relation
    878:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    879:      *
    880:      * @return    CountryI18nQuery A secondary query class using the current class as primary query
    881:      */
    882:     public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    883:     {
    884:         return $this
    885:             ->joinI18n($locale, $relationAlias, $joinType)
    886:             ->useQuery($relationAlias ? $relationAlias : 'CountryI18n', 'Thelia\Model\CountryI18nQuery');
    887:     }
    888:
    889: }
    890: