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