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\Accessory;
16: use Thelia\Model\ContentAssoc;
17: use Thelia\Model\Document;
18: use Thelia\Model\FeatureProd;
19: use Thelia\Model\Image;
20: use Thelia\Model\Product;
21: use Thelia\Model\ProductCategory;
22: use Thelia\Model\ProductI18n;
23: use Thelia\Model\ProductPeer;
24: use Thelia\Model\ProductQuery;
25: use Thelia\Model\ProductVersion;
26: use Thelia\Model\Rewriting;
27: use Thelia\Model\Stock;
28: use Thelia\Model\TaxRule;
29:
30: /**
31: * Base class that represents a query for the 'product' table.
32: *
33: *
34: *
35: * @method ProductQuery orderById($order = Criteria::ASC) Order by the id column
36: * @method ProductQuery orderByTaxRuleId($order = Criteria::ASC) Order by the tax_rule_id column
37: * @method ProductQuery orderByRef($order = Criteria::ASC) Order by the ref column
38: * @method ProductQuery orderByPrice($order = Criteria::ASC) Order by the price column
39: * @method ProductQuery orderByPrice2($order = Criteria::ASC) Order by the price2 column
40: * @method ProductQuery orderByEcotax($order = Criteria::ASC) Order by the ecotax column
41: * @method ProductQuery orderByNewness($order = Criteria::ASC) Order by the newness column
42: * @method ProductQuery orderByPromo($order = Criteria::ASC) Order by the promo column
43: * @method ProductQuery orderByStock($order = Criteria::ASC) Order by the stock column
44: * @method ProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column
45: * @method ProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column
46: * @method ProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
47: * @method ProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
48: * @method ProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
49: * @method ProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
50: * @method ProductQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
51: * @method ProductQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
52: *
53: * @method ProductQuery groupById() Group by the id column
54: * @method ProductQuery groupByTaxRuleId() Group by the tax_rule_id column
55: * @method ProductQuery groupByRef() Group by the ref column
56: * @method ProductQuery groupByPrice() Group by the price column
57: * @method ProductQuery groupByPrice2() Group by the price2 column
58: * @method ProductQuery groupByEcotax() Group by the ecotax column
59: * @method ProductQuery groupByNewness() Group by the newness column
60: * @method ProductQuery groupByPromo() Group by the promo column
61: * @method ProductQuery groupByStock() Group by the stock column
62: * @method ProductQuery groupByVisible() Group by the visible column
63: * @method ProductQuery groupByWeight() Group by the weight column
64: * @method ProductQuery groupByPosition() Group by the position column
65: * @method ProductQuery groupByCreatedAt() Group by the created_at column
66: * @method ProductQuery groupByUpdatedAt() Group by the updated_at column
67: * @method ProductQuery groupByVersion() Group by the version column
68: * @method ProductQuery groupByVersionCreatedAt() Group by the version_created_at column
69: * @method ProductQuery groupByVersionCreatedBy() Group by the version_created_by column
70: *
71: * @method ProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
72: * @method ProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
73: * @method ProductQuery innerJoin($relation) Adds a INNER JOIN clause to the query
74: *
75: * @method ProductQuery leftJoinTaxRule($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRule relation
76: * @method ProductQuery rightJoinTaxRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRule relation
77: * @method ProductQuery innerJoinTaxRule($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRule relation
78: *
79: * @method ProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
80: * @method ProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
81: * @method ProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
82: *
83: * @method ProductQuery leftJoinFeatureProd($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureProd relation
84: * @method ProductQuery rightJoinFeatureProd($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProd relation
85: * @method ProductQuery innerJoinFeatureProd($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProd relation
86: *
87: * @method ProductQuery leftJoinStock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Stock relation
88: * @method ProductQuery rightJoinStock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Stock relation
89: * @method ProductQuery innerJoinStock($relationAlias = null) Adds a INNER JOIN clause to the query using the Stock relation
90: *
91: * @method ProductQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
92: * @method ProductQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
93: * @method ProductQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
94: *
95: * @method ProductQuery leftJoinImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Image relation
96: * @method ProductQuery rightJoinImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Image relation
97: * @method ProductQuery innerJoinImage($relationAlias = null) Adds a INNER JOIN clause to the query using the Image relation
98: *
99: * @method ProductQuery leftJoinDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the Document relation
100: * @method ProductQuery rightJoinDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Document relation
101: * @method ProductQuery innerJoinDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the Document relation
102: *
103: * @method ProductQuery leftJoinAccessoryRelatedByProductId($relationAlias = null) Adds a LEFT JOIN clause to the query using the AccessoryRelatedByProductId relation
104: * @method ProductQuery rightJoinAccessoryRelatedByProductId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AccessoryRelatedByProductId relation
105: * @method ProductQuery innerJoinAccessoryRelatedByProductId($relationAlias = null) Adds a INNER JOIN clause to the query using the AccessoryRelatedByProductId relation
106: *
107: * @method ProductQuery leftJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AccessoryRelatedByAccessory relation
108: * @method ProductQuery rightJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AccessoryRelatedByAccessory relation
109: * @method ProductQuery innerJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a INNER JOIN clause to the query using the AccessoryRelatedByAccessory relation
110: *
111: * @method ProductQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
112: * @method ProductQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
113: * @method ProductQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
114: *
115: * @method ProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation
116: * @method ProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
117: * @method ProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
118: *
119: * @method ProductQuery leftJoinProductVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductVersion relation
120: * @method ProductQuery rightJoinProductVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductVersion relation
121: * @method ProductQuery innerJoinProductVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductVersion relation
122: *
123: * @method Product findOne(PropelPDO $con = null) Return the first Product matching the query
124: * @method Product findOneOrCreate(PropelPDO $con = null) Return the first Product matching the query, or a new Product object populated from the query conditions when no match is found
125: *
126: * @method Product findOneById(int $id) Return the first Product filtered by the id column
127: * @method Product findOneByTaxRuleId(int $tax_rule_id) Return the first Product filtered by the tax_rule_id column
128: * @method Product findOneByRef(string $ref) Return the first Product filtered by the ref column
129: * @method Product findOneByPrice(double $price) Return the first Product filtered by the price column
130: * @method Product findOneByPrice2(double $price2) Return the first Product filtered by the price2 column
131: * @method Product findOneByEcotax(double $ecotax) Return the first Product filtered by the ecotax column
132: * @method Product findOneByNewness(int $newness) Return the first Product filtered by the newness column
133: * @method Product findOneByPromo(int $promo) Return the first Product filtered by the promo column
134: * @method Product findOneByStock(int $stock) Return the first Product filtered by the stock column
135: * @method Product findOneByVisible(int $visible) Return the first Product filtered by the visible column
136: * @method Product findOneByWeight(double $weight) Return the first Product filtered by the weight column
137: * @method Product findOneByPosition(int $position) Return the first Product filtered by the position column
138: * @method Product findOneByCreatedAt(string $created_at) Return the first Product filtered by the created_at column
139: * @method Product findOneByUpdatedAt(string $updated_at) Return the first Product filtered by the updated_at column
140: * @method Product findOneByVersion(int $version) Return the first Product filtered by the version column
141: * @method Product findOneByVersionCreatedAt(string $version_created_at) Return the first Product filtered by the version_created_at column
142: * @method Product findOneByVersionCreatedBy(string $version_created_by) Return the first Product filtered by the version_created_by column
143: *
144: * @method array findById(int $id) Return Product objects filtered by the id column
145: * @method array findByTaxRuleId(int $tax_rule_id) Return Product objects filtered by the tax_rule_id column
146: * @method array findByRef(string $ref) Return Product objects filtered by the ref column
147: * @method array findByPrice(double $price) Return Product objects filtered by the price column
148: * @method array findByPrice2(double $price2) Return Product objects filtered by the price2 column
149: * @method array findByEcotax(double $ecotax) Return Product objects filtered by the ecotax column
150: * @method array findByNewness(int $newness) Return Product objects filtered by the newness column
151: * @method array findByPromo(int $promo) Return Product objects filtered by the promo column
152: * @method array findByStock(int $stock) Return Product objects filtered by the stock column
153: * @method array findByVisible(int $visible) Return Product objects filtered by the visible column
154: * @method array findByWeight(double $weight) Return Product objects filtered by the weight column
155: * @method array findByPosition(int $position) Return Product objects filtered by the position column
156: * @method array findByCreatedAt(string $created_at) Return Product objects filtered by the created_at column
157: * @method array findByUpdatedAt(string $updated_at) Return Product objects filtered by the updated_at column
158: * @method array findByVersion(int $version) Return Product objects filtered by the version column
159: * @method array findByVersionCreatedAt(string $version_created_at) Return Product objects filtered by the version_created_at column
160: * @method array findByVersionCreatedBy(string $version_created_by) Return Product objects filtered by the version_created_by column
161: *
162: * @package propel.generator.Thelia.Model.om
163: */
164: abstract class BaseProductQuery extends ModelCriteria
165: {
166: /**
167: * Initializes internal state of BaseProductQuery object.
168: *
169: * @param string $dbName The dabase name
170: * @param string $modelName The phpName of a model, e.g. 'Book'
171: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
172: */
173: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Product', $modelAlias = null)
174: {
175: parent::__construct($dbName, $modelName, $modelAlias);
176: }
177:
178: /**
179: * Returns a new ProductQuery object.
180: *
181: * @param string $modelAlias The alias of a model in the query
182: * @param ProductQuery|Criteria $criteria Optional Criteria to build the query from
183: *
184: * @return ProductQuery
185: */
186: public static function create($modelAlias = null, $criteria = null)
187: {
188: if ($criteria instanceof ProductQuery) {
189: return $criteria;
190: }
191: $query = new ProductQuery();
192: if (null !== $modelAlias) {
193: $query->setModelAlias($modelAlias);
194: }
195: if ($criteria instanceof Criteria) {
196: $query->mergeWith($criteria);
197: }
198:
199: return $query;
200: }
201:
202: /**
203: * Find object by primary key.
204: * Propel uses the instance pool to skip the database if the object exists.
205: * Go fast if the query is untouched.
206: *
207: * <code>
208: * $obj = $c->findPk(12, $con);
209: * </code>
210: *
211: * @param mixed $key Primary key to use for the query
212: * @param PropelPDO $con an optional connection object
213: *
214: * @return Product|Product[]|mixed the result, formatted by the current formatter
215: */
216: public function findPk($key, $con = null)
217: {
218: if ($key === null) {
219: return null;
220: }
221: if ((null !== ($obj = ProductPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
222: // the object is alredy in the instance pool
223: return $obj;
224: }
225: if ($con === null) {
226: $con = Propel::getConnection(ProductPeer::DATABASE_NAME, Propel::CONNECTION_READ);
227: }
228: $this->basePreSelect($con);
229: if ($this->formatter || $this->modelAlias || $this->with || $this->select
230: || $this->selectColumns || $this->asColumns || $this->selectModifiers
231: || $this->map || $this->having || $this->joins) {
232: return $this->findPkComplex($key, $con);
233: } else {
234: return $this->findPkSimple($key, $con);
235: }
236: }
237:
238: /**
239: * Find object by primary key using raw SQL to go fast.
240: * Bypass doSelect() and the object formatter by using generated code.
241: *
242: * @param mixed $key Primary key to use for the query
243: * @param PropelPDO $con A connection object
244: *
245: * @return Product A model object, or null if the key is not found
246: * @throws PropelException
247: */
248: protected function findPkSimple($key, $con)
249: {
250: $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `PRICE`, `PRICE2`, `ECOTAX`, `NEWNESS`, `PROMO`, `STOCK`, `VISIBLE`, `WEIGHT`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0';
251: try {
252: $stmt = $con->prepare($sql);
253: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
254: $stmt->execute();
255: } catch (Exception $e) {
256: Propel::log($e->getMessage(), Propel::LOG_ERR);
257: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
258: }
259: $obj = null;
260: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
261: $obj = new Product();
262: $obj->hydrate($row);
263: ProductPeer::addInstanceToPool($obj, (string) $key);
264: }
265: $stmt->closeCursor();
266:
267: return $obj;
268: }
269:
270: /**
271: * Find object by primary key.
272: *
273: * @param mixed $key Primary key to use for the query
274: * @param PropelPDO $con A connection object
275: *
276: * @return Product|Product[]|mixed the result, formatted by the current formatter
277: */
278: protected function findPkComplex($key, $con)
279: {
280: // As the query uses a PK condition, no limit(1) is necessary.
281: $criteria = $this->isKeepQuery() ? clone $this : $this;
282: $stmt = $criteria
283: ->filterByPrimaryKey($key)
284: ->doSelect($con);
285:
286: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
287: }
288:
289: /**
290: * Find objects by primary key
291: * <code>
292: * $objs = $c->findPks(array(12, 56, 832), $con);
293: * </code>
294: * @param array $keys Primary keys to use for the query
295: * @param PropelPDO $con an optional connection object
296: *
297: * @return PropelObjectCollection|Product[]|mixed the list of results, formatted by the current formatter
298: */
299: public function findPks($keys, $con = null)
300: {
301: if ($con === null) {
302: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
303: }
304: $this->basePreSelect($con);
305: $criteria = $this->isKeepQuery() ? clone $this : $this;
306: $stmt = $criteria
307: ->filterByPrimaryKeys($keys)
308: ->doSelect($con);
309:
310: return $criteria->getFormatter()->init($criteria)->format($stmt);
311: }
312:
313: /**
314: * Filter the query by primary key
315: *
316: * @param mixed $key Primary key to use for the query
317: *
318: * @return ProductQuery The current query, for fluid interface
319: */
320: public function filterByPrimaryKey($key)
321: {
322:
323: return $this->addUsingAlias(ProductPeer::ID, $key, Criteria::EQUAL);
324: }
325:
326: /**
327: * Filter the query by a list of primary keys
328: *
329: * @param array $keys The list of primary key to use for the query
330: *
331: * @return ProductQuery The current query, for fluid interface
332: */
333: public function filterByPrimaryKeys($keys)
334: {
335:
336: return $this->addUsingAlias(ProductPeer::ID, $keys, Criteria::IN);
337: }
338:
339: /**
340: * Filter the query on the id column
341: *
342: * Example usage:
343: * <code>
344: * $query->filterById(1234); // WHERE id = 1234
345: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
346: * $query->filterById(array('min' => 12)); // WHERE id > 12
347: * </code>
348: *
349: * @param mixed $id The value to use as filter.
350: * Use scalar values for equality.
351: * Use array values for in_array() equivalent.
352: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
353: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
354: *
355: * @return ProductQuery The current query, for fluid interface
356: */
357: public function filterById($id = null, $comparison = null)
358: {
359: if (is_array($id) && null === $comparison) {
360: $comparison = Criteria::IN;
361: }
362:
363: return $this->addUsingAlias(ProductPeer::ID, $id, $comparison);
364: }
365:
366: /**
367: * Filter the query on the tax_rule_id column
368: *
369: * Example usage:
370: * <code>
371: * $query->filterByTaxRuleId(1234); // WHERE tax_rule_id = 1234
372: * $query->filterByTaxRuleId(array(12, 34)); // WHERE tax_rule_id IN (12, 34)
373: * $query->filterByTaxRuleId(array('min' => 12)); // WHERE tax_rule_id > 12
374: * </code>
375: *
376: * @see filterByTaxRule()
377: *
378: * @param mixed $taxRuleId The value to use as filter.
379: * Use scalar values for equality.
380: * Use array values for in_array() equivalent.
381: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
382: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
383: *
384: * @return ProductQuery The current query, for fluid interface
385: */
386: public function filterByTaxRuleId($taxRuleId = null, $comparison = null)
387: {
388: if (is_array($taxRuleId)) {
389: $useMinMax = false;
390: if (isset($taxRuleId['min'])) {
391: $this->addUsingAlias(ProductPeer::TAX_RULE_ID, $taxRuleId['min'], Criteria::GREATER_EQUAL);
392: $useMinMax = true;
393: }
394: if (isset($taxRuleId['max'])) {
395: $this->addUsingAlias(ProductPeer::TAX_RULE_ID, $taxRuleId['max'], Criteria::LESS_EQUAL);
396: $useMinMax = true;
397: }
398: if ($useMinMax) {
399: return $this;
400: }
401: if (null === $comparison) {
402: $comparison = Criteria::IN;
403: }
404: }
405:
406: return $this->addUsingAlias(ProductPeer::TAX_RULE_ID, $taxRuleId, $comparison);
407: }
408:
409: /**
410: * Filter the query on the ref column
411: *
412: * Example usage:
413: * <code>
414: * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
415: * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
416: * </code>
417: *
418: * @param string $ref The value to use as filter.
419: * Accepts wildcards (* and % trigger a LIKE)
420: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
421: *
422: * @return ProductQuery The current query, for fluid interface
423: */
424: public function filterByRef($ref = null, $comparison = null)
425: {
426: if (null === $comparison) {
427: if (is_array($ref)) {
428: $comparison = Criteria::IN;
429: } elseif (preg_match('/[\%\*]/', $ref)) {
430: $ref = str_replace('*', '%', $ref);
431: $comparison = Criteria::LIKE;
432: }
433: }
434:
435: return $this->addUsingAlias(ProductPeer::REF, $ref, $comparison);
436: }
437:
438: /**
439: * Filter the query on the price column
440: *
441: * Example usage:
442: * <code>
443: * $query->filterByPrice(1234); // WHERE price = 1234
444: * $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
445: * $query->filterByPrice(array('min' => 12)); // WHERE price > 12
446: * </code>
447: *
448: * @param mixed $price The value to use as filter.
449: * Use scalar values for equality.
450: * Use array values for in_array() equivalent.
451: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
452: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
453: *
454: * @return ProductQuery The current query, for fluid interface
455: */
456: public function filterByPrice($price = null, $comparison = null)
457: {
458: if (is_array($price)) {
459: $useMinMax = false;
460: if (isset($price['min'])) {
461: $this->addUsingAlias(ProductPeer::PRICE, $price['min'], Criteria::GREATER_EQUAL);
462: $useMinMax = true;
463: }
464: if (isset($price['max'])) {
465: $this->addUsingAlias(ProductPeer::PRICE, $price['max'], Criteria::LESS_EQUAL);
466: $useMinMax = true;
467: }
468: if ($useMinMax) {
469: return $this;
470: }
471: if (null === $comparison) {
472: $comparison = Criteria::IN;
473: }
474: }
475:
476: return $this->addUsingAlias(ProductPeer::PRICE, $price, $comparison);
477: }
478:
479: /**
480: * Filter the query on the price2 column
481: *
482: * Example usage:
483: * <code>
484: * $query->filterByPrice2(1234); // WHERE price2 = 1234
485: * $query->filterByPrice2(array(12, 34)); // WHERE price2 IN (12, 34)
486: * $query->filterByPrice2(array('min' => 12)); // WHERE price2 > 12
487: * </code>
488: *
489: * @param mixed $price2 The value to use as filter.
490: * Use scalar values for equality.
491: * Use array values for in_array() equivalent.
492: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
493: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
494: *
495: * @return ProductQuery The current query, for fluid interface
496: */
497: public function filterByPrice2($price2 = null, $comparison = null)
498: {
499: if (is_array($price2)) {
500: $useMinMax = false;
501: if (isset($price2['min'])) {
502: $this->addUsingAlias(ProductPeer::PRICE2, $price2['min'], Criteria::GREATER_EQUAL);
503: $useMinMax = true;
504: }
505: if (isset($price2['max'])) {
506: $this->addUsingAlias(ProductPeer::PRICE2, $price2['max'], Criteria::LESS_EQUAL);
507: $useMinMax = true;
508: }
509: if ($useMinMax) {
510: return $this;
511: }
512: if (null === $comparison) {
513: $comparison = Criteria::IN;
514: }
515: }
516:
517: return $this->addUsingAlias(ProductPeer::PRICE2, $price2, $comparison);
518: }
519:
520: /**
521: * Filter the query on the ecotax column
522: *
523: * Example usage:
524: * <code>
525: * $query->filterByEcotax(1234); // WHERE ecotax = 1234
526: * $query->filterByEcotax(array(12, 34)); // WHERE ecotax IN (12, 34)
527: * $query->filterByEcotax(array('min' => 12)); // WHERE ecotax > 12
528: * </code>
529: *
530: * @param mixed $ecotax The value to use as filter.
531: * Use scalar values for equality.
532: * Use array values for in_array() equivalent.
533: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
534: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
535: *
536: * @return ProductQuery The current query, for fluid interface
537: */
538: public function filterByEcotax($ecotax = null, $comparison = null)
539: {
540: if (is_array($ecotax)) {
541: $useMinMax = false;
542: if (isset($ecotax['min'])) {
543: $this->addUsingAlias(ProductPeer::ECOTAX, $ecotax['min'], Criteria::GREATER_EQUAL);
544: $useMinMax = true;
545: }
546: if (isset($ecotax['max'])) {
547: $this->addUsingAlias(ProductPeer::ECOTAX, $ecotax['max'], Criteria::LESS_EQUAL);
548: $useMinMax = true;
549: }
550: if ($useMinMax) {
551: return $this;
552: }
553: if (null === $comparison) {
554: $comparison = Criteria::IN;
555: }
556: }
557:
558: return $this->addUsingAlias(ProductPeer::ECOTAX, $ecotax, $comparison);
559: }
560:
561: /**
562: * Filter the query on the newness column
563: *
564: * Example usage:
565: * <code>
566: * $query->filterByNewness(1234); // WHERE newness = 1234
567: * $query->filterByNewness(array(12, 34)); // WHERE newness IN (12, 34)
568: * $query->filterByNewness(array('min' => 12)); // WHERE newness > 12
569: * </code>
570: *
571: * @param mixed $newness The value to use as filter.
572: * Use scalar values for equality.
573: * Use array values for in_array() equivalent.
574: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
575: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
576: *
577: * @return ProductQuery The current query, for fluid interface
578: */
579: public function filterByNewness($newness = null, $comparison = null)
580: {
581: if (is_array($newness)) {
582: $useMinMax = false;
583: if (isset($newness['min'])) {
584: $this->addUsingAlias(ProductPeer::NEWNESS, $newness['min'], Criteria::GREATER_EQUAL);
585: $useMinMax = true;
586: }
587: if (isset($newness['max'])) {
588: $this->addUsingAlias(ProductPeer::NEWNESS, $newness['max'], Criteria::LESS_EQUAL);
589: $useMinMax = true;
590: }
591: if ($useMinMax) {
592: return $this;
593: }
594: if (null === $comparison) {
595: $comparison = Criteria::IN;
596: }
597: }
598:
599: return $this->addUsingAlias(ProductPeer::NEWNESS, $newness, $comparison);
600: }
601:
602: /**
603: * Filter the query on the promo column
604: *
605: * Example usage:
606: * <code>
607: * $query->filterByPromo(1234); // WHERE promo = 1234
608: * $query->filterByPromo(array(12, 34)); // WHERE promo IN (12, 34)
609: * $query->filterByPromo(array('min' => 12)); // WHERE promo > 12
610: * </code>
611: *
612: * @param mixed $promo The value to use as filter.
613: * Use scalar values for equality.
614: * Use array values for in_array() equivalent.
615: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
616: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
617: *
618: * @return ProductQuery The current query, for fluid interface
619: */
620: public function filterByPromo($promo = null, $comparison = null)
621: {
622: if (is_array($promo)) {
623: $useMinMax = false;
624: if (isset($promo['min'])) {
625: $this->addUsingAlias(ProductPeer::PROMO, $promo['min'], Criteria::GREATER_EQUAL);
626: $useMinMax = true;
627: }
628: if (isset($promo['max'])) {
629: $this->addUsingAlias(ProductPeer::PROMO, $promo['max'], Criteria::LESS_EQUAL);
630: $useMinMax = true;
631: }
632: if ($useMinMax) {
633: return $this;
634: }
635: if (null === $comparison) {
636: $comparison = Criteria::IN;
637: }
638: }
639:
640: return $this->addUsingAlias(ProductPeer::PROMO, $promo, $comparison);
641: }
642:
643: /**
644: * Filter the query on the stock column
645: *
646: * Example usage:
647: * <code>
648: * $query->filterByStock(1234); // WHERE stock = 1234
649: * $query->filterByStock(array(12, 34)); // WHERE stock IN (12, 34)
650: * $query->filterByStock(array('min' => 12)); // WHERE stock > 12
651: * </code>
652: *
653: * @param mixed $stock The value to use as filter.
654: * Use scalar values for equality.
655: * Use array values for in_array() equivalent.
656: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
657: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
658: *
659: * @return ProductQuery The current query, for fluid interface
660: */
661: public function filterByStock($stock = null, $comparison = null)
662: {
663: if (is_array($stock)) {
664: $useMinMax = false;
665: if (isset($stock['min'])) {
666: $this->addUsingAlias(ProductPeer::STOCK, $stock['min'], Criteria::GREATER_EQUAL);
667: $useMinMax = true;
668: }
669: if (isset($stock['max'])) {
670: $this->addUsingAlias(ProductPeer::STOCK, $stock['max'], Criteria::LESS_EQUAL);
671: $useMinMax = true;
672: }
673: if ($useMinMax) {
674: return $this;
675: }
676: if (null === $comparison) {
677: $comparison = Criteria::IN;
678: }
679: }
680:
681: return $this->addUsingAlias(ProductPeer::STOCK, $stock, $comparison);
682: }
683:
684: /**
685: * Filter the query on the visible column
686: *
687: * Example usage:
688: * <code>
689: * $query->filterByVisible(1234); // WHERE visible = 1234
690: * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
691: * $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
692: * </code>
693: *
694: * @param mixed $visible The value to use as filter.
695: * Use scalar values for equality.
696: * Use array values for in_array() equivalent.
697: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
698: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
699: *
700: * @return ProductQuery The current query, for fluid interface
701: */
702: public function filterByVisible($visible = null, $comparison = null)
703: {
704: if (is_array($visible)) {
705: $useMinMax = false;
706: if (isset($visible['min'])) {
707: $this->addUsingAlias(ProductPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
708: $useMinMax = true;
709: }
710: if (isset($visible['max'])) {
711: $this->addUsingAlias(ProductPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
712: $useMinMax = true;
713: }
714: if ($useMinMax) {
715: return $this;
716: }
717: if (null === $comparison) {
718: $comparison = Criteria::IN;
719: }
720: }
721:
722: return $this->addUsingAlias(ProductPeer::VISIBLE, $visible, $comparison);
723: }
724:
725: /**
726: * Filter the query on the weight column
727: *
728: * Example usage:
729: * <code>
730: * $query->filterByWeight(1234); // WHERE weight = 1234
731: * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34)
732: * $query->filterByWeight(array('min' => 12)); // WHERE weight > 12
733: * </code>
734: *
735: * @param mixed $weight The value to use as filter.
736: * Use scalar values for equality.
737: * Use array values for in_array() equivalent.
738: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
739: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
740: *
741: * @return ProductQuery The current query, for fluid interface
742: */
743: public function filterByWeight($weight = null, $comparison = null)
744: {
745: if (is_array($weight)) {
746: $useMinMax = false;
747: if (isset($weight['min'])) {
748: $this->addUsingAlias(ProductPeer::WEIGHT, $weight['min'], Criteria::GREATER_EQUAL);
749: $useMinMax = true;
750: }
751: if (isset($weight['max'])) {
752: $this->addUsingAlias(ProductPeer::WEIGHT, $weight['max'], Criteria::LESS_EQUAL);
753: $useMinMax = true;
754: }
755: if ($useMinMax) {
756: return $this;
757: }
758: if (null === $comparison) {
759: $comparison = Criteria::IN;
760: }
761: }
762:
763: return $this->addUsingAlias(ProductPeer::WEIGHT, $weight, $comparison);
764: }
765:
766: /**
767: * Filter the query on the position column
768: *
769: * Example usage:
770: * <code>
771: * $query->filterByPosition(1234); // WHERE position = 1234
772: * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
773: * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
774: * </code>
775: *
776: * @param mixed $position The value to use as filter.
777: * Use scalar values for equality.
778: * Use array values for in_array() equivalent.
779: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
780: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
781: *
782: * @return ProductQuery The current query, for fluid interface
783: */
784: public function filterByPosition($position = null, $comparison = null)
785: {
786: if (is_array($position)) {
787: $useMinMax = false;
788: if (isset($position['min'])) {
789: $this->addUsingAlias(ProductPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
790: $useMinMax = true;
791: }
792: if (isset($position['max'])) {
793: $this->addUsingAlias(ProductPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
794: $useMinMax = true;
795: }
796: if ($useMinMax) {
797: return $this;
798: }
799: if (null === $comparison) {
800: $comparison = Criteria::IN;
801: }
802: }
803:
804: return $this->addUsingAlias(ProductPeer::POSITION, $position, $comparison);
805: }
806:
807: /**
808: * Filter the query on the created_at column
809: *
810: * Example usage:
811: * <code>
812: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
813: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
814: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
815: * </code>
816: *
817: * @param mixed $createdAt The value to use as filter.
818: * Values can be integers (unix timestamps), DateTime objects, or strings.
819: * Empty strings are treated as NULL.
820: * Use scalar values for equality.
821: * Use array values for in_array() equivalent.
822: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
823: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
824: *
825: * @return ProductQuery The current query, for fluid interface
826: */
827: public function filterByCreatedAt($createdAt = null, $comparison = null)
828: {
829: if (is_array($createdAt)) {
830: $useMinMax = false;
831: if (isset($createdAt['min'])) {
832: $this->addUsingAlias(ProductPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
833: $useMinMax = true;
834: }
835: if (isset($createdAt['max'])) {
836: $this->addUsingAlias(ProductPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
837: $useMinMax = true;
838: }
839: if ($useMinMax) {
840: return $this;
841: }
842: if (null === $comparison) {
843: $comparison = Criteria::IN;
844: }
845: }
846:
847: return $this->addUsingAlias(ProductPeer::CREATED_AT, $createdAt, $comparison);
848: }
849:
850: /**
851: * Filter the query on the updated_at column
852: *
853: * Example usage:
854: * <code>
855: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
856: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
857: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
858: * </code>
859: *
860: * @param mixed $updatedAt The value to use as filter.
861: * Values can be integers (unix timestamps), DateTime objects, or strings.
862: * Empty strings are treated as NULL.
863: * Use scalar values for equality.
864: * Use array values for in_array() equivalent.
865: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
866: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
867: *
868: * @return ProductQuery The current query, for fluid interface
869: */
870: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
871: {
872: if (is_array($updatedAt)) {
873: $useMinMax = false;
874: if (isset($updatedAt['min'])) {
875: $this->addUsingAlias(ProductPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
876: $useMinMax = true;
877: }
878: if (isset($updatedAt['max'])) {
879: $this->addUsingAlias(ProductPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
880: $useMinMax = true;
881: }
882: if ($useMinMax) {
883: return $this;
884: }
885: if (null === $comparison) {
886: $comparison = Criteria::IN;
887: }
888: }
889:
890: return $this->addUsingAlias(ProductPeer::UPDATED_AT, $updatedAt, $comparison);
891: }
892:
893: /**
894: * Filter the query on the version column
895: *
896: * Example usage:
897: * <code>
898: * $query->filterByVersion(1234); // WHERE version = 1234
899: * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
900: * $query->filterByVersion(array('min' => 12)); // WHERE version > 12
901: * </code>
902: *
903: * @param mixed $version The value to use as filter.
904: * Use scalar values for equality.
905: * Use array values for in_array() equivalent.
906: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
907: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
908: *
909: * @return ProductQuery The current query, for fluid interface
910: */
911: public function filterByVersion($version = null, $comparison = null)
912: {
913: if (is_array($version)) {
914: $useMinMax = false;
915: if (isset($version['min'])) {
916: $this->addUsingAlias(ProductPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
917: $useMinMax = true;
918: }
919: if (isset($version['max'])) {
920: $this->addUsingAlias(ProductPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
921: $useMinMax = true;
922: }
923: if ($useMinMax) {
924: return $this;
925: }
926: if (null === $comparison) {
927: $comparison = Criteria::IN;
928: }
929: }
930:
931: return $this->addUsingAlias(ProductPeer::VERSION, $version, $comparison);
932: }
933:
934: /**
935: * Filter the query on the version_created_at column
936: *
937: * Example usage:
938: * <code>
939: * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
940: * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
941: * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
942: * </code>
943: *
944: * @param mixed $versionCreatedAt The value to use as filter.
945: * Values can be integers (unix timestamps), DateTime objects, or strings.
946: * Empty strings are treated as NULL.
947: * Use scalar values for equality.
948: * Use array values for in_array() equivalent.
949: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
950: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
951: *
952: * @return ProductQuery The current query, for fluid interface
953: */
954: public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
955: {
956: if (is_array($versionCreatedAt)) {
957: $useMinMax = false;
958: if (isset($versionCreatedAt['min'])) {
959: $this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
960: $useMinMax = true;
961: }
962: if (isset($versionCreatedAt['max'])) {
963: $this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
964: $useMinMax = true;
965: }
966: if ($useMinMax) {
967: return $this;
968: }
969: if (null === $comparison) {
970: $comparison = Criteria::IN;
971: }
972: }
973:
974: return $this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
975: }
976:
977: /**
978: * Filter the query on the version_created_by column
979: *
980: * Example usage:
981: * <code>
982: * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
983: * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
984: * </code>
985: *
986: * @param string $versionCreatedBy The value to use as filter.
987: * Accepts wildcards (* and % trigger a LIKE)
988: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
989: *
990: * @return ProductQuery The current query, for fluid interface
991: */
992: public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
993: {
994: if (null === $comparison) {
995: if (is_array($versionCreatedBy)) {
996: $comparison = Criteria::IN;
997: } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
998: $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
999: $comparison = Criteria::LIKE;
1000: }
1001: }
1002:
1003: return $this->addUsingAlias(ProductPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
1004: }
1005:
1006: /**
1007: * Filter the query by a related TaxRule object
1008: *
1009: * @param TaxRule|PropelObjectCollection $taxRule The related object(s) to use as filter
1010: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1011: *
1012: * @return ProductQuery The current query, for fluid interface
1013: * @throws PropelException - if the provided filter is invalid.
1014: */
1015: public function filterByTaxRule($taxRule, $comparison = null)
1016: {
1017: if ($taxRule instanceof TaxRule) {
1018: return $this
1019: ->addUsingAlias(ProductPeer::TAX_RULE_ID, $taxRule->getId(), $comparison);
1020: } elseif ($taxRule instanceof PropelObjectCollection) {
1021: if (null === $comparison) {
1022: $comparison = Criteria::IN;
1023: }
1024:
1025: return $this
1026: ->addUsingAlias(ProductPeer::TAX_RULE_ID, $taxRule->toKeyValue('PrimaryKey', 'Id'), $comparison);
1027: } else {
1028: throw new PropelException('filterByTaxRule() only accepts arguments of type TaxRule or PropelCollection');
1029: }
1030: }
1031:
1032: /**
1033: * Adds a JOIN clause to the query using the TaxRule relation
1034: *
1035: * @param string $relationAlias optional alias for the relation
1036: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1037: *
1038: * @return ProductQuery The current query, for fluid interface
1039: */
1040: public function joinTaxRule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1041: {
1042: $tableMap = $this->getTableMap();
1043: $relationMap = $tableMap->getRelation('TaxRule');
1044:
1045: // create a ModelJoin object for this join
1046: $join = new ModelJoin();
1047: $join->setJoinType($joinType);
1048: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1049: if ($previousJoin = $this->getPreviousJoin()) {
1050: $join->setPreviousJoin($previousJoin);
1051: }
1052:
1053: // add the ModelJoin to the current object
1054: if ($relationAlias) {
1055: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1056: $this->addJoinObject($join, $relationAlias);
1057: } else {
1058: $this->addJoinObject($join, 'TaxRule');
1059: }
1060:
1061: return $this;
1062: }
1063:
1064: /**
1065: * Use the TaxRule relation TaxRule object
1066: *
1067: * @see useQuery()
1068: *
1069: * @param string $relationAlias optional alias for the relation,
1070: * to be used as main alias in the secondary query
1071: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1072: *
1073: * @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query
1074: */
1075: public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1076: {
1077: return $this
1078: ->joinTaxRule($relationAlias, $joinType)
1079: ->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
1080: }
1081:
1082: /**
1083: * Filter the query by a related ProductCategory object
1084: *
1085: * @param ProductCategory|PropelObjectCollection $productCategory the related object to use as filter
1086: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1087: *
1088: * @return ProductQuery The current query, for fluid interface
1089: * @throws PropelException - if the provided filter is invalid.
1090: */
1091: public function filterByProductCategory($productCategory, $comparison = null)
1092: {
1093: if ($productCategory instanceof ProductCategory) {
1094: return $this
1095: ->addUsingAlias(ProductPeer::ID, $productCategory->getProductId(), $comparison);
1096: } elseif ($productCategory instanceof PropelObjectCollection) {
1097: return $this
1098: ->useProductCategoryQuery()
1099: ->filterByPrimaryKeys($productCategory->getPrimaryKeys())
1100: ->endUse();
1101: } else {
1102: throw new PropelException('filterByProductCategory() only accepts arguments of type ProductCategory or PropelCollection');
1103: }
1104: }
1105:
1106: /**
1107: * Adds a JOIN clause to the query using the ProductCategory relation
1108: *
1109: * @param string $relationAlias optional alias for the relation
1110: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1111: *
1112: * @return ProductQuery The current query, for fluid interface
1113: */
1114: public function joinProductCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1115: {
1116: $tableMap = $this->getTableMap();
1117: $relationMap = $tableMap->getRelation('ProductCategory');
1118:
1119: // create a ModelJoin object for this join
1120: $join = new ModelJoin();
1121: $join->setJoinType($joinType);
1122: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1123: if ($previousJoin = $this->getPreviousJoin()) {
1124: $join->setPreviousJoin($previousJoin);
1125: }
1126:
1127: // add the ModelJoin to the current object
1128: if ($relationAlias) {
1129: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1130: $this->addJoinObject($join, $relationAlias);
1131: } else {
1132: $this->addJoinObject($join, 'ProductCategory');
1133: }
1134:
1135: return $this;
1136: }
1137:
1138: /**
1139: * Use the ProductCategory relation ProductCategory object
1140: *
1141: * @see useQuery()
1142: *
1143: * @param string $relationAlias optional alias for the relation,
1144: * to be used as main alias in the secondary query
1145: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1146: *
1147: * @return \Thelia\Model\ProductCategoryQuery A secondary query class using the current class as primary query
1148: */
1149: public function useProductCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1150: {
1151: return $this
1152: ->joinProductCategory($relationAlias, $joinType)
1153: ->useQuery($relationAlias ? $relationAlias : 'ProductCategory', '\Thelia\Model\ProductCategoryQuery');
1154: }
1155:
1156: /**
1157: * Filter the query by a related FeatureProd object
1158: *
1159: * @param FeatureProd|PropelObjectCollection $featureProd the related object to use as filter
1160: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1161: *
1162: * @return ProductQuery The current query, for fluid interface
1163: * @throws PropelException - if the provided filter is invalid.
1164: */
1165: public function filterByFeatureProd($featureProd, $comparison = null)
1166: {
1167: if ($featureProd instanceof FeatureProd) {
1168: return $this
1169: ->addUsingAlias(ProductPeer::ID, $featureProd->getProductId(), $comparison);
1170: } elseif ($featureProd instanceof PropelObjectCollection) {
1171: return $this
1172: ->useFeatureProdQuery()
1173: ->filterByPrimaryKeys($featureProd->getPrimaryKeys())
1174: ->endUse();
1175: } else {
1176: throw new PropelException('filterByFeatureProd() only accepts arguments of type FeatureProd or PropelCollection');
1177: }
1178: }
1179:
1180: /**
1181: * Adds a JOIN clause to the query using the FeatureProd relation
1182: *
1183: * @param string $relationAlias optional alias for the relation
1184: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1185: *
1186: * @return ProductQuery The current query, for fluid interface
1187: */
1188: public function joinFeatureProd($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1189: {
1190: $tableMap = $this->getTableMap();
1191: $relationMap = $tableMap->getRelation('FeatureProd');
1192:
1193: // create a ModelJoin object for this join
1194: $join = new ModelJoin();
1195: $join->setJoinType($joinType);
1196: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1197: if ($previousJoin = $this->getPreviousJoin()) {
1198: $join->setPreviousJoin($previousJoin);
1199: }
1200:
1201: // add the ModelJoin to the current object
1202: if ($relationAlias) {
1203: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1204: $this->addJoinObject($join, $relationAlias);
1205: } else {
1206: $this->addJoinObject($join, 'FeatureProd');
1207: }
1208:
1209: return $this;
1210: }
1211:
1212: /**
1213: * Use the FeatureProd relation FeatureProd object
1214: *
1215: * @see useQuery()
1216: *
1217: * @param string $relationAlias optional alias for the relation,
1218: * to be used as main alias in the secondary query
1219: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1220: *
1221: * @return \Thelia\Model\FeatureProdQuery A secondary query class using the current class as primary query
1222: */
1223: public function useFeatureProdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1224: {
1225: return $this
1226: ->joinFeatureProd($relationAlias, $joinType)
1227: ->useQuery($relationAlias ? $relationAlias : 'FeatureProd', '\Thelia\Model\FeatureProdQuery');
1228: }
1229:
1230: /**
1231: * Filter the query by a related Stock object
1232: *
1233: * @param Stock|PropelObjectCollection $stock the related object to use as filter
1234: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1235: *
1236: * @return ProductQuery The current query, for fluid interface
1237: * @throws PropelException - if the provided filter is invalid.
1238: */
1239: public function filterByStock($stock, $comparison = null)
1240: {
1241: if ($stock instanceof Stock) {
1242: return $this
1243: ->addUsingAlias(ProductPeer::ID, $stock->getProductId(), $comparison);
1244: } elseif ($stock instanceof PropelObjectCollection) {
1245: return $this
1246: ->useStockQuery()
1247: ->filterByPrimaryKeys($stock->getPrimaryKeys())
1248: ->endUse();
1249: } else {
1250: throw new PropelException('filterByStock() only accepts arguments of type Stock or PropelCollection');
1251: }
1252: }
1253:
1254: /**
1255: * Adds a JOIN clause to the query using the Stock relation
1256: *
1257: * @param string $relationAlias optional alias for the relation
1258: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1259: *
1260: * @return ProductQuery The current query, for fluid interface
1261: */
1262: public function joinStock($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1263: {
1264: $tableMap = $this->getTableMap();
1265: $relationMap = $tableMap->getRelation('Stock');
1266:
1267: // create a ModelJoin object for this join
1268: $join = new ModelJoin();
1269: $join->setJoinType($joinType);
1270: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1271: if ($previousJoin = $this->getPreviousJoin()) {
1272: $join->setPreviousJoin($previousJoin);
1273: }
1274:
1275: // add the ModelJoin to the current object
1276: if ($relationAlias) {
1277: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1278: $this->addJoinObject($join, $relationAlias);
1279: } else {
1280: $this->addJoinObject($join, 'Stock');
1281: }
1282:
1283: return $this;
1284: }
1285:
1286: /**
1287: * Use the Stock relation Stock object
1288: *
1289: * @see useQuery()
1290: *
1291: * @param string $relationAlias optional alias for the relation,
1292: * to be used as main alias in the secondary query
1293: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1294: *
1295: * @return \Thelia\Model\StockQuery A secondary query class using the current class as primary query
1296: */
1297: public function useStockQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1298: {
1299: return $this
1300: ->joinStock($relationAlias, $joinType)
1301: ->useQuery($relationAlias ? $relationAlias : 'Stock', '\Thelia\Model\StockQuery');
1302: }
1303:
1304: /**
1305: * Filter the query by a related ContentAssoc object
1306: *
1307: * @param ContentAssoc|PropelObjectCollection $contentAssoc the related object to use as filter
1308: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1309: *
1310: * @return ProductQuery The current query, for fluid interface
1311: * @throws PropelException - if the provided filter is invalid.
1312: */
1313: public function filterByContentAssoc($contentAssoc, $comparison = null)
1314: {
1315: if ($contentAssoc instanceof ContentAssoc) {
1316: return $this
1317: ->addUsingAlias(ProductPeer::ID, $contentAssoc->getProductId(), $comparison);
1318: } elseif ($contentAssoc instanceof PropelObjectCollection) {
1319: return $this
1320: ->useContentAssocQuery()
1321: ->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
1322: ->endUse();
1323: } else {
1324: throw new PropelException('filterByContentAssoc() only accepts arguments of type ContentAssoc or PropelCollection');
1325: }
1326: }
1327:
1328: /**
1329: * Adds a JOIN clause to the query using the ContentAssoc relation
1330: *
1331: * @param string $relationAlias optional alias for the relation
1332: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1333: *
1334: * @return ProductQuery The current query, for fluid interface
1335: */
1336: public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1337: {
1338: $tableMap = $this->getTableMap();
1339: $relationMap = $tableMap->getRelation('ContentAssoc');
1340:
1341: // create a ModelJoin object for this join
1342: $join = new ModelJoin();
1343: $join->setJoinType($joinType);
1344: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1345: if ($previousJoin = $this->getPreviousJoin()) {
1346: $join->setPreviousJoin($previousJoin);
1347: }
1348:
1349: // add the ModelJoin to the current object
1350: if ($relationAlias) {
1351: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1352: $this->addJoinObject($join, $relationAlias);
1353: } else {
1354: $this->addJoinObject($join, 'ContentAssoc');
1355: }
1356:
1357: return $this;
1358: }
1359:
1360: /**
1361: * Use the ContentAssoc relation ContentAssoc object
1362: *
1363: * @see useQuery()
1364: *
1365: * @param string $relationAlias optional alias for the relation,
1366: * to be used as main alias in the secondary query
1367: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1368: *
1369: * @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query
1370: */
1371: public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1372: {
1373: return $this
1374: ->joinContentAssoc($relationAlias, $joinType)
1375: ->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
1376: }
1377:
1378: /**
1379: * Filter the query by a related Image object
1380: *
1381: * @param Image|PropelObjectCollection $image the related object to use as filter
1382: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1383: *
1384: * @return ProductQuery The current query, for fluid interface
1385: * @throws PropelException - if the provided filter is invalid.
1386: */
1387: public function filterByImage($image, $comparison = null)
1388: {
1389: if ($image instanceof Image) {
1390: return $this
1391: ->addUsingAlias(ProductPeer::ID, $image->getProductId(), $comparison);
1392: } elseif ($image instanceof PropelObjectCollection) {
1393: return $this
1394: ->useImageQuery()
1395: ->filterByPrimaryKeys($image->getPrimaryKeys())
1396: ->endUse();
1397: } else {
1398: throw new PropelException('filterByImage() only accepts arguments of type Image or PropelCollection');
1399: }
1400: }
1401:
1402: /**
1403: * Adds a JOIN clause to the query using the Image relation
1404: *
1405: * @param string $relationAlias optional alias for the relation
1406: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1407: *
1408: * @return ProductQuery The current query, for fluid interface
1409: */
1410: public function joinImage($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1411: {
1412: $tableMap = $this->getTableMap();
1413: $relationMap = $tableMap->getRelation('Image');
1414:
1415: // create a ModelJoin object for this join
1416: $join = new ModelJoin();
1417: $join->setJoinType($joinType);
1418: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1419: if ($previousJoin = $this->getPreviousJoin()) {
1420: $join->setPreviousJoin($previousJoin);
1421: }
1422:
1423: // add the ModelJoin to the current object
1424: if ($relationAlias) {
1425: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1426: $this->addJoinObject($join, $relationAlias);
1427: } else {
1428: $this->addJoinObject($join, 'Image');
1429: }
1430:
1431: return $this;
1432: }
1433:
1434: /**
1435: * Use the Image relation Image object
1436: *
1437: * @see useQuery()
1438: *
1439: * @param string $relationAlias optional alias for the relation,
1440: * to be used as main alias in the secondary query
1441: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1442: *
1443: * @return \Thelia\Model\ImageQuery A secondary query class using the current class as primary query
1444: */
1445: public function useImageQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1446: {
1447: return $this
1448: ->joinImage($relationAlias, $joinType)
1449: ->useQuery($relationAlias ? $relationAlias : 'Image', '\Thelia\Model\ImageQuery');
1450: }
1451:
1452: /**
1453: * Filter the query by a related Document object
1454: *
1455: * @param Document|PropelObjectCollection $document the related object to use as filter
1456: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1457: *
1458: * @return ProductQuery The current query, for fluid interface
1459: * @throws PropelException - if the provided filter is invalid.
1460: */
1461: public function filterByDocument($document, $comparison = null)
1462: {
1463: if ($document instanceof Document) {
1464: return $this
1465: ->addUsingAlias(ProductPeer::ID, $document->getProductId(), $comparison);
1466: } elseif ($document instanceof PropelObjectCollection) {
1467: return $this
1468: ->useDocumentQuery()
1469: ->filterByPrimaryKeys($document->getPrimaryKeys())
1470: ->endUse();
1471: } else {
1472: throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection');
1473: }
1474: }
1475:
1476: /**
1477: * Adds a JOIN clause to the query using the Document relation
1478: *
1479: * @param string $relationAlias optional alias for the relation
1480: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1481: *
1482: * @return ProductQuery The current query, for fluid interface
1483: */
1484: public function joinDocument($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1485: {
1486: $tableMap = $this->getTableMap();
1487: $relationMap = $tableMap->getRelation('Document');
1488:
1489: // create a ModelJoin object for this join
1490: $join = new ModelJoin();
1491: $join->setJoinType($joinType);
1492: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1493: if ($previousJoin = $this->getPreviousJoin()) {
1494: $join->setPreviousJoin($previousJoin);
1495: }
1496:
1497: // add the ModelJoin to the current object
1498: if ($relationAlias) {
1499: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1500: $this->addJoinObject($join, $relationAlias);
1501: } else {
1502: $this->addJoinObject($join, 'Document');
1503: }
1504:
1505: return $this;
1506: }
1507:
1508: /**
1509: * Use the Document relation Document object
1510: *
1511: * @see useQuery()
1512: *
1513: * @param string $relationAlias optional alias for the relation,
1514: * to be used as main alias in the secondary query
1515: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1516: *
1517: * @return \Thelia\Model\DocumentQuery A secondary query class using the current class as primary query
1518: */
1519: public function useDocumentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1520: {
1521: return $this
1522: ->joinDocument($relationAlias, $joinType)
1523: ->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery');
1524: }
1525:
1526: /**
1527: * Filter the query by a related Accessory object
1528: *
1529: * @param Accessory|PropelObjectCollection $accessory the related object to use as filter
1530: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1531: *
1532: * @return ProductQuery The current query, for fluid interface
1533: * @throws PropelException - if the provided filter is invalid.
1534: */
1535: public function filterByAccessoryRelatedByProductId($accessory, $comparison = null)
1536: {
1537: if ($accessory instanceof Accessory) {
1538: return $this
1539: ->addUsingAlias(ProductPeer::ID, $accessory->getProductId(), $comparison);
1540: } elseif ($accessory instanceof PropelObjectCollection) {
1541: return $this
1542: ->useAccessoryRelatedByProductIdQuery()
1543: ->filterByPrimaryKeys($accessory->getPrimaryKeys())
1544: ->endUse();
1545: } else {
1546: throw new PropelException('filterByAccessoryRelatedByProductId() only accepts arguments of type Accessory or PropelCollection');
1547: }
1548: }
1549:
1550: /**
1551: * Adds a JOIN clause to the query using the AccessoryRelatedByProductId relation
1552: *
1553: * @param string $relationAlias optional alias for the relation
1554: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1555: *
1556: * @return ProductQuery The current query, for fluid interface
1557: */
1558: public function joinAccessoryRelatedByProductId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1559: {
1560: $tableMap = $this->getTableMap();
1561: $relationMap = $tableMap->getRelation('AccessoryRelatedByProductId');
1562:
1563: // create a ModelJoin object for this join
1564: $join = new ModelJoin();
1565: $join->setJoinType($joinType);
1566: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1567: if ($previousJoin = $this->getPreviousJoin()) {
1568: $join->setPreviousJoin($previousJoin);
1569: }
1570:
1571: // add the ModelJoin to the current object
1572: if ($relationAlias) {
1573: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1574: $this->addJoinObject($join, $relationAlias);
1575: } else {
1576: $this->addJoinObject($join, 'AccessoryRelatedByProductId');
1577: }
1578:
1579: return $this;
1580: }
1581:
1582: /**
1583: * Use the AccessoryRelatedByProductId relation Accessory object
1584: *
1585: * @see useQuery()
1586: *
1587: * @param string $relationAlias optional alias for the relation,
1588: * to be used as main alias in the secondary query
1589: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1590: *
1591: * @return \Thelia\Model\AccessoryQuery A secondary query class using the current class as primary query
1592: */
1593: public function useAccessoryRelatedByProductIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1594: {
1595: return $this
1596: ->joinAccessoryRelatedByProductId($relationAlias, $joinType)
1597: ->useQuery($relationAlias ? $relationAlias : 'AccessoryRelatedByProductId', '\Thelia\Model\AccessoryQuery');
1598: }
1599:
1600: /**
1601: * Filter the query by a related Accessory object
1602: *
1603: * @param Accessory|PropelObjectCollection $accessory the related object to use as filter
1604: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1605: *
1606: * @return ProductQuery The current query, for fluid interface
1607: * @throws PropelException - if the provided filter is invalid.
1608: */
1609: public function filterByAccessoryRelatedByAccessory($accessory, $comparison = null)
1610: {
1611: if ($accessory instanceof Accessory) {
1612: return $this
1613: ->addUsingAlias(ProductPeer::ID, $accessory->getAccessory(), $comparison);
1614: } elseif ($accessory instanceof PropelObjectCollection) {
1615: return $this
1616: ->useAccessoryRelatedByAccessoryQuery()
1617: ->filterByPrimaryKeys($accessory->getPrimaryKeys())
1618: ->endUse();
1619: } else {
1620: throw new PropelException('filterByAccessoryRelatedByAccessory() only accepts arguments of type Accessory or PropelCollection');
1621: }
1622: }
1623:
1624: /**
1625: * Adds a JOIN clause to the query using the AccessoryRelatedByAccessory relation
1626: *
1627: * @param string $relationAlias optional alias for the relation
1628: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1629: *
1630: * @return ProductQuery The current query, for fluid interface
1631: */
1632: public function joinAccessoryRelatedByAccessory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1633: {
1634: $tableMap = $this->getTableMap();
1635: $relationMap = $tableMap->getRelation('AccessoryRelatedByAccessory');
1636:
1637: // create a ModelJoin object for this join
1638: $join = new ModelJoin();
1639: $join->setJoinType($joinType);
1640: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1641: if ($previousJoin = $this->getPreviousJoin()) {
1642: $join->setPreviousJoin($previousJoin);
1643: }
1644:
1645: // add the ModelJoin to the current object
1646: if ($relationAlias) {
1647: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1648: $this->addJoinObject($join, $relationAlias);
1649: } else {
1650: $this->addJoinObject($join, 'AccessoryRelatedByAccessory');
1651: }
1652:
1653: return $this;
1654: }
1655:
1656: /**
1657: * Use the AccessoryRelatedByAccessory relation Accessory object
1658: *
1659: * @see useQuery()
1660: *
1661: * @param string $relationAlias optional alias for the relation,
1662: * to be used as main alias in the secondary query
1663: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1664: *
1665: * @return \Thelia\Model\AccessoryQuery A secondary query class using the current class as primary query
1666: */
1667: public function useAccessoryRelatedByAccessoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1668: {
1669: return $this
1670: ->joinAccessoryRelatedByAccessory($relationAlias, $joinType)
1671: ->useQuery($relationAlias ? $relationAlias : 'AccessoryRelatedByAccessory', '\Thelia\Model\AccessoryQuery');
1672: }
1673:
1674: /**
1675: * Filter the query by a related Rewriting object
1676: *
1677: * @param Rewriting|PropelObjectCollection $rewriting the related object to use as filter
1678: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1679: *
1680: * @return ProductQuery The current query, for fluid interface
1681: * @throws PropelException - if the provided filter is invalid.
1682: */
1683: public function filterByRewriting($rewriting, $comparison = null)
1684: {
1685: if ($rewriting instanceof Rewriting) {
1686: return $this
1687: ->addUsingAlias(ProductPeer::ID, $rewriting->getProductId(), $comparison);
1688: } elseif ($rewriting instanceof PropelObjectCollection) {
1689: return $this
1690: ->useRewritingQuery()
1691: ->filterByPrimaryKeys($rewriting->getPrimaryKeys())
1692: ->endUse();
1693: } else {
1694: throw new PropelException('filterByRewriting() only accepts arguments of type Rewriting or PropelCollection');
1695: }
1696: }
1697:
1698: /**
1699: * Adds a JOIN clause to the query using the Rewriting relation
1700: *
1701: * @param string $relationAlias optional alias for the relation
1702: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1703: *
1704: * @return ProductQuery The current query, for fluid interface
1705: */
1706: public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1707: {
1708: $tableMap = $this->getTableMap();
1709: $relationMap = $tableMap->getRelation('Rewriting');
1710:
1711: // create a ModelJoin object for this join
1712: $join = new ModelJoin();
1713: $join->setJoinType($joinType);
1714: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1715: if ($previousJoin = $this->getPreviousJoin()) {
1716: $join->setPreviousJoin($previousJoin);
1717: }
1718:
1719: // add the ModelJoin to the current object
1720: if ($relationAlias) {
1721: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1722: $this->addJoinObject($join, $relationAlias);
1723: } else {
1724: $this->addJoinObject($join, 'Rewriting');
1725: }
1726:
1727: return $this;
1728: }
1729:
1730: /**
1731: * Use the Rewriting relation Rewriting object
1732: *
1733: * @see useQuery()
1734: *
1735: * @param string $relationAlias optional alias for the relation,
1736: * to be used as main alias in the secondary query
1737: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1738: *
1739: * @return \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query
1740: */
1741: public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1742: {
1743: return $this
1744: ->joinRewriting($relationAlias, $joinType)
1745: ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery');
1746: }
1747:
1748: /**
1749: * Filter the query by a related ProductI18n object
1750: *
1751: * @param ProductI18n|PropelObjectCollection $productI18n the related object to use as filter
1752: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1753: *
1754: * @return ProductQuery The current query, for fluid interface
1755: * @throws PropelException - if the provided filter is invalid.
1756: */
1757: public function filterByProductI18n($productI18n, $comparison = null)
1758: {
1759: if ($productI18n instanceof ProductI18n) {
1760: return $this
1761: ->addUsingAlias(ProductPeer::ID, $productI18n->getId(), $comparison);
1762: } elseif ($productI18n instanceof PropelObjectCollection) {
1763: return $this
1764: ->useProductI18nQuery()
1765: ->filterByPrimaryKeys($productI18n->getPrimaryKeys())
1766: ->endUse();
1767: } else {
1768: throw new PropelException('filterByProductI18n() only accepts arguments of type ProductI18n or PropelCollection');
1769: }
1770: }
1771:
1772: /**
1773: * Adds a JOIN clause to the query using the ProductI18n relation
1774: *
1775: * @param string $relationAlias optional alias for the relation
1776: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1777: *
1778: * @return ProductQuery The current query, for fluid interface
1779: */
1780: public function joinProductI18n($relationAlias = null, $joinType = 'LEFT JOIN')
1781: {
1782: $tableMap = $this->getTableMap();
1783: $relationMap = $tableMap->getRelation('ProductI18n');
1784:
1785: // create a ModelJoin object for this join
1786: $join = new ModelJoin();
1787: $join->setJoinType($joinType);
1788: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1789: if ($previousJoin = $this->getPreviousJoin()) {
1790: $join->setPreviousJoin($previousJoin);
1791: }
1792:
1793: // add the ModelJoin to the current object
1794: if ($relationAlias) {
1795: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1796: $this->addJoinObject($join, $relationAlias);
1797: } else {
1798: $this->addJoinObject($join, 'ProductI18n');
1799: }
1800:
1801: return $this;
1802: }
1803:
1804: /**
1805: * Use the ProductI18n relation ProductI18n object
1806: *
1807: * @see useQuery()
1808: *
1809: * @param string $relationAlias optional alias for the relation,
1810: * to be used as main alias in the secondary query
1811: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1812: *
1813: * @return \Thelia\Model\ProductI18nQuery A secondary query class using the current class as primary query
1814: */
1815: public function useProductI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
1816: {
1817: return $this
1818: ->joinProductI18n($relationAlias, $joinType)
1819: ->useQuery($relationAlias ? $relationAlias : 'ProductI18n', '\Thelia\Model\ProductI18nQuery');
1820: }
1821:
1822: /**
1823: * Filter the query by a related ProductVersion object
1824: *
1825: * @param ProductVersion|PropelObjectCollection $productVersion the related object to use as filter
1826: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1827: *
1828: * @return ProductQuery The current query, for fluid interface
1829: * @throws PropelException - if the provided filter is invalid.
1830: */
1831: public function filterByProductVersion($productVersion, $comparison = null)
1832: {
1833: if ($productVersion instanceof ProductVersion) {
1834: return $this
1835: ->addUsingAlias(ProductPeer::ID, $productVersion->getId(), $comparison);
1836: } elseif ($productVersion instanceof PropelObjectCollection) {
1837: return $this
1838: ->useProductVersionQuery()
1839: ->filterByPrimaryKeys($productVersion->getPrimaryKeys())
1840: ->endUse();
1841: } else {
1842: throw new PropelException('filterByProductVersion() only accepts arguments of type ProductVersion or PropelCollection');
1843: }
1844: }
1845:
1846: /**
1847: * Adds a JOIN clause to the query using the ProductVersion relation
1848: *
1849: * @param string $relationAlias optional alias for the relation
1850: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1851: *
1852: * @return ProductQuery The current query, for fluid interface
1853: */
1854: public function joinProductVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1855: {
1856: $tableMap = $this->getTableMap();
1857: $relationMap = $tableMap->getRelation('ProductVersion');
1858:
1859: // create a ModelJoin object for this join
1860: $join = new ModelJoin();
1861: $join->setJoinType($joinType);
1862: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1863: if ($previousJoin = $this->getPreviousJoin()) {
1864: $join->setPreviousJoin($previousJoin);
1865: }
1866:
1867: // add the ModelJoin to the current object
1868: if ($relationAlias) {
1869: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1870: $this->addJoinObject($join, $relationAlias);
1871: } else {
1872: $this->addJoinObject($join, 'ProductVersion');
1873: }
1874:
1875: return $this;
1876: }
1877:
1878: /**
1879: * Use the ProductVersion relation ProductVersion object
1880: *
1881: * @see useQuery()
1882: *
1883: * @param string $relationAlias optional alias for the relation,
1884: * to be used as main alias in the secondary query
1885: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1886: *
1887: * @return \Thelia\Model\ProductVersionQuery A secondary query class using the current class as primary query
1888: */
1889: public function useProductVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1890: {
1891: return $this
1892: ->joinProductVersion($relationAlias, $joinType)
1893: ->useQuery($relationAlias ? $relationAlias : 'ProductVersion', '\Thelia\Model\ProductVersionQuery');
1894: }
1895:
1896: /**
1897: * Exclude object from result
1898: *
1899: * @param Product $product Object to remove from the list of results
1900: *
1901: * @return ProductQuery The current query, for fluid interface
1902: */
1903: public function prune($product = null)
1904: {
1905: if ($product) {
1906: $this->addUsingAlias(ProductPeer::ID, $product->getId(), Criteria::NOT_EQUAL);
1907: }
1908:
1909: return $this;
1910: }
1911:
1912: // timestampable behavior
1913:
1914: /**
1915: * Filter by the latest updated
1916: *
1917: * @param int $nbDays Maximum age of the latest update in days
1918: *
1919: * @return ProductQuery The current query, for fluid interface
1920: */
1921: public function recentlyUpdated($nbDays = 7)
1922: {
1923: return $this->addUsingAlias(ProductPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1924: }
1925:
1926: /**
1927: * Order by update date desc
1928: *
1929: * @return ProductQuery The current query, for fluid interface
1930: */
1931: public function lastUpdatedFirst()
1932: {
1933: return $this->addDescendingOrderByColumn(ProductPeer::UPDATED_AT);
1934: }
1935:
1936: /**
1937: * Order by update date asc
1938: *
1939: * @return ProductQuery The current query, for fluid interface
1940: */
1941: public function firstUpdatedFirst()
1942: {
1943: return $this->addAscendingOrderByColumn(ProductPeer::UPDATED_AT);
1944: }
1945:
1946: /**
1947: * Filter by the latest created
1948: *
1949: * @param int $nbDays Maximum age of in days
1950: *
1951: * @return ProductQuery The current query, for fluid interface
1952: */
1953: public function recentlyCreated($nbDays = 7)
1954: {
1955: return $this->addUsingAlias(ProductPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1956: }
1957:
1958: /**
1959: * Order by create date desc
1960: *
1961: * @return ProductQuery The current query, for fluid interface
1962: */
1963: public function lastCreatedFirst()
1964: {
1965: return $this->addDescendingOrderByColumn(ProductPeer::CREATED_AT);
1966: }
1967:
1968: /**
1969: * Order by create date asc
1970: *
1971: * @return ProductQuery The current query, for fluid interface
1972: */
1973: public function firstCreatedFirst()
1974: {
1975: return $this->addAscendingOrderByColumn(ProductPeer::CREATED_AT);
1976: }
1977: // i18n behavior
1978:
1979: /**
1980: * Adds a JOIN clause to the query using the i18n relation
1981: *
1982: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
1983: * @param string $relationAlias optional alias for the relation
1984: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
1985: *
1986: * @return ProductQuery The current query, for fluid interface
1987: */
1988: public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1989: {
1990: $relationName = $relationAlias ? $relationAlias : 'ProductI18n';
1991:
1992: return $this
1993: ->joinProductI18n($relationAlias, $joinType)
1994: ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
1995: }
1996:
1997: /**
1998: * Adds a JOIN clause to the query and hydrates the related I18n object.
1999: * Shortcut for $c->joinI18n($locale)->with()
2000: *
2001: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
2002: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
2003: *
2004: * @return ProductQuery The current query, for fluid interface
2005: */
2006: public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
2007: {
2008: $this
2009: ->joinI18n($locale, null, $joinType)
2010: ->with('ProductI18n');
2011: $this->with['ProductI18n']->setIsWithOneToMany(false);
2012:
2013: return $this;
2014: }
2015:
2016: /**
2017: * Use the I18n relation query object
2018: *
2019: * @see useQuery()
2020: *
2021: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
2022: * @param string $relationAlias optional alias for the relation
2023: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
2024: *
2025: * @return ProductI18nQuery A secondary query class using the current class as primary query
2026: */
2027: public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
2028: {
2029: return $this
2030: ->joinI18n($locale, $relationAlias, $joinType)
2031: ->useQuery($relationAlias ? $relationAlias : 'ProductI18n', 'Thelia\Model\ProductI18nQuery');
2032: }
2033:
2034: }
2035: