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