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\Product;
16: use Thelia\Model\ProductVersion;
17: use Thelia\Model\ProductVersionPeer;
18: use Thelia\Model\ProductVersionQuery;
19:
20: /**
21: * Base class that represents a query for the 'product_version' table.
22: *
23: *
24: *
25: * @method ProductVersionQuery orderById($order = Criteria::ASC) Order by the id column
26: * @method ProductVersionQuery orderByTaxRuleId($order = Criteria::ASC) Order by the tax_rule_id column
27: * @method ProductVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column
28: * @method ProductVersionQuery orderByPrice($order = Criteria::ASC) Order by the price column
29: * @method ProductVersionQuery orderByPrice2($order = Criteria::ASC) Order by the price2 column
30: * @method ProductVersionQuery orderByEcotax($order = Criteria::ASC) Order by the ecotax column
31: * @method ProductVersionQuery orderByNewness($order = Criteria::ASC) Order by the newness column
32: * @method ProductVersionQuery orderByPromo($order = Criteria::ASC) Order by the promo column
33: * @method ProductVersionQuery orderByStock($order = Criteria::ASC) Order by the stock column
34: * @method ProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
35: * @method ProductVersionQuery orderByWeight($order = Criteria::ASC) Order by the weight column
36: * @method ProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
37: * @method ProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
38: * @method ProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
39: * @method ProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
40: * @method ProductVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
41: * @method ProductVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
42: *
43: * @method ProductVersionQuery groupById() Group by the id column
44: * @method ProductVersionQuery groupByTaxRuleId() Group by the tax_rule_id column
45: * @method ProductVersionQuery groupByRef() Group by the ref column
46: * @method ProductVersionQuery groupByPrice() Group by the price column
47: * @method ProductVersionQuery groupByPrice2() Group by the price2 column
48: * @method ProductVersionQuery groupByEcotax() Group by the ecotax column
49: * @method ProductVersionQuery groupByNewness() Group by the newness column
50: * @method ProductVersionQuery groupByPromo() Group by the promo column
51: * @method ProductVersionQuery groupByStock() Group by the stock column
52: * @method ProductVersionQuery groupByVisible() Group by the visible column
53: * @method ProductVersionQuery groupByWeight() Group by the weight column
54: * @method ProductVersionQuery groupByPosition() Group by the position column
55: * @method ProductVersionQuery groupByCreatedAt() Group by the created_at column
56: * @method ProductVersionQuery groupByUpdatedAt() Group by the updated_at column
57: * @method ProductVersionQuery groupByVersion() Group by the version column
58: * @method ProductVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
59: * @method ProductVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
60: *
61: * @method ProductVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
62: * @method ProductVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
63: * @method ProductVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
64: *
65: * @method ProductVersionQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
66: * @method ProductVersionQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
67: * @method ProductVersionQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
68: *
69: * @method ProductVersion findOne(PropelPDO $con = null) Return the first ProductVersion matching the query
70: * @method ProductVersion findOneOrCreate(PropelPDO $con = null) Return the first ProductVersion matching the query, or a new ProductVersion object populated from the query conditions when no match is found
71: *
72: * @method ProductVersion findOneById(int $id) Return the first ProductVersion filtered by the id column
73: * @method ProductVersion findOneByTaxRuleId(int $tax_rule_id) Return the first ProductVersion filtered by the tax_rule_id column
74: * @method ProductVersion findOneByRef(string $ref) Return the first ProductVersion filtered by the ref column
75: * @method ProductVersion findOneByPrice(double $price) Return the first ProductVersion filtered by the price column
76: * @method ProductVersion findOneByPrice2(double $price2) Return the first ProductVersion filtered by the price2 column
77: * @method ProductVersion findOneByEcotax(double $ecotax) Return the first ProductVersion filtered by the ecotax column
78: * @method ProductVersion findOneByNewness(int $newness) Return the first ProductVersion filtered by the newness column
79: * @method ProductVersion findOneByPromo(int $promo) Return the first ProductVersion filtered by the promo column
80: * @method ProductVersion findOneByStock(int $stock) Return the first ProductVersion filtered by the stock column
81: * @method ProductVersion findOneByVisible(int $visible) Return the first ProductVersion filtered by the visible column
82: * @method ProductVersion findOneByWeight(double $weight) Return the first ProductVersion filtered by the weight column
83: * @method ProductVersion findOneByPosition(int $position) Return the first ProductVersion filtered by the position column
84: * @method ProductVersion findOneByCreatedAt(string $created_at) Return the first ProductVersion filtered by the created_at column
85: * @method ProductVersion findOneByUpdatedAt(string $updated_at) Return the first ProductVersion filtered by the updated_at column
86: * @method ProductVersion findOneByVersion(int $version) Return the first ProductVersion filtered by the version column
87: * @method ProductVersion findOneByVersionCreatedAt(string $version_created_at) Return the first ProductVersion filtered by the version_created_at column
88: * @method ProductVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ProductVersion filtered by the version_created_by column
89: *
90: * @method array findById(int $id) Return ProductVersion objects filtered by the id column
91: * @method array findByTaxRuleId(int $tax_rule_id) Return ProductVersion objects filtered by the tax_rule_id column
92: * @method array findByRef(string $ref) Return ProductVersion objects filtered by the ref column
93: * @method array findByPrice(double $price) Return ProductVersion objects filtered by the price column
94: * @method array findByPrice2(double $price2) Return ProductVersion objects filtered by the price2 column
95: * @method array findByEcotax(double $ecotax) Return ProductVersion objects filtered by the ecotax column
96: * @method array findByNewness(int $newness) Return ProductVersion objects filtered by the newness column
97: * @method array findByPromo(int $promo) Return ProductVersion objects filtered by the promo column
98: * @method array findByStock(int $stock) Return ProductVersion objects filtered by the stock column
99: * @method array findByVisible(int $visible) Return ProductVersion objects filtered by the visible column
100: * @method array findByWeight(double $weight) Return ProductVersion objects filtered by the weight column
101: * @method array findByPosition(int $position) Return ProductVersion objects filtered by the position column
102: * @method array findByCreatedAt(string $created_at) Return ProductVersion objects filtered by the created_at column
103: * @method array findByUpdatedAt(string $updated_at) Return ProductVersion objects filtered by the updated_at column
104: * @method array findByVersion(int $version) Return ProductVersion objects filtered by the version column
105: * @method array findByVersionCreatedAt(string $version_created_at) Return ProductVersion objects filtered by the version_created_at column
106: * @method array findByVersionCreatedBy(string $version_created_by) Return ProductVersion objects filtered by the version_created_by column
107: *
108: * @package propel.generator.Thelia.Model.om
109: */
110: abstract class BaseProductVersionQuery extends ModelCriteria
111: {
112: /**
113: * Initializes internal state of BaseProductVersionQuery object.
114: *
115: * @param string $dbName The dabase name
116: * @param string $modelName The phpName of a model, e.g. 'Book'
117: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
118: */
119: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ProductVersion', $modelAlias = null)
120: {
121: parent::__construct($dbName, $modelName, $modelAlias);
122: }
123:
124: /**
125: * Returns a new ProductVersionQuery object.
126: *
127: * @param string $modelAlias The alias of a model in the query
128: * @param ProductVersionQuery|Criteria $criteria Optional Criteria to build the query from
129: *
130: * @return ProductVersionQuery
131: */
132: public static function create($modelAlias = null, $criteria = null)
133: {
134: if ($criteria instanceof ProductVersionQuery) {
135: return $criteria;
136: }
137: $query = new ProductVersionQuery();
138: if (null !== $modelAlias) {
139: $query->setModelAlias($modelAlias);
140: }
141: if ($criteria instanceof Criteria) {
142: $query->mergeWith($criteria);
143: }
144:
145: return $query;
146: }
147:
148: /**
149: * Find object by primary key.
150: * Propel uses the instance pool to skip the database if the object exists.
151: * Go fast if the query is untouched.
152: *
153: * <code>
154: * $obj = $c->findPk(array(12, 34), $con);
155: * </code>
156: *
157: * @param array $key Primary key to use for the query
158: A Primary key composition: [$id, $version]
159: * @param PropelPDO $con an optional connection object
160: *
161: * @return ProductVersion|ProductVersion[]|mixed the result, formatted by the current formatter
162: */
163: public function findPk($key, $con = null)
164: {
165: if ($key === null) {
166: return null;
167: }
168: if ((null !== ($obj = ProductVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
169: // the object is alredy in the instance pool
170: return $obj;
171: }
172: if ($con === null) {
173: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
174: }
175: $this->basePreSelect($con);
176: if ($this->formatter || $this->modelAlias || $this->with || $this->select
177: || $this->selectColumns || $this->asColumns || $this->selectModifiers
178: || $this->map || $this->having || $this->joins) {
179: return $this->findPkComplex($key, $con);
180: } else {
181: return $this->findPkSimple($key, $con);
182: }
183: }
184:
185: /**
186: * Find object by primary key using raw SQL to go fast.
187: * Bypass doSelect() and the object formatter by using generated code.
188: *
189: * @param mixed $key Primary key to use for the query
190: * @param PropelPDO $con A connection object
191: *
192: * @return ProductVersion A model object, or null if the key is not found
193: * @throws PropelException
194: */
195: protected function findPkSimple($key, $con)
196: {
197: $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_version` WHERE `id` = :p0 AND `version` = :p1';
198: try {
199: $stmt = $con->prepare($sql);
200: $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
201: $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
202: $stmt->execute();
203: } catch (Exception $e) {
204: Propel::log($e->getMessage(), Propel::LOG_ERR);
205: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
206: }
207: $obj = null;
208: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
209: $obj = new ProductVersion();
210: $obj->hydrate($row);
211: ProductVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
212: }
213: $stmt->closeCursor();
214:
215: return $obj;
216: }
217:
218: /**
219: * Find object by primary key.
220: *
221: * @param mixed $key Primary key to use for the query
222: * @param PropelPDO $con A connection object
223: *
224: * @return ProductVersion|ProductVersion[]|mixed the result, formatted by the current formatter
225: */
226: protected function findPkComplex($key, $con)
227: {
228: // As the query uses a PK condition, no limit(1) is necessary.
229: $criteria = $this->isKeepQuery() ? clone $this : $this;
230: $stmt = $criteria
231: ->filterByPrimaryKey($key)
232: ->doSelect($con);
233:
234: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
235: }
236:
237: /**
238: * Find objects by primary key
239: * <code>
240: * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
241: * </code>
242: * @param array $keys Primary keys to use for the query
243: * @param PropelPDO $con an optional connection object
244: *
245: * @return PropelObjectCollection|ProductVersion[]|mixed the list of results, formatted by the current formatter
246: */
247: public function findPks($keys, $con = null)
248: {
249: if ($con === null) {
250: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
251: }
252: $this->basePreSelect($con);
253: $criteria = $this->isKeepQuery() ? clone $this : $this;
254: $stmt = $criteria
255: ->filterByPrimaryKeys($keys)
256: ->doSelect($con);
257:
258: return $criteria->getFormatter()->init($criteria)->format($stmt);
259: }
260:
261: /**
262: * Filter the query by primary key
263: *
264: * @param mixed $key Primary key to use for the query
265: *
266: * @return ProductVersionQuery The current query, for fluid interface
267: */
268: public function filterByPrimaryKey($key)
269: {
270: $this->addUsingAlias(ProductVersionPeer::ID, $key[0], Criteria::EQUAL);
271: $this->addUsingAlias(ProductVersionPeer::VERSION, $key[1], Criteria::EQUAL);
272:
273: return $this;
274: }
275:
276: /**
277: * Filter the query by a list of primary keys
278: *
279: * @param array $keys The list of primary key to use for the query
280: *
281: * @return ProductVersionQuery The current query, for fluid interface
282: */
283: public function filterByPrimaryKeys($keys)
284: {
285: if (empty($keys)) {
286: return $this->add(null, '1<>1', Criteria::CUSTOM);
287: }
288: foreach ($keys as $key) {
289: $cton0 = $this->getNewCriterion(ProductVersionPeer::ID, $key[0], Criteria::EQUAL);
290: $cton1 = $this->getNewCriterion(ProductVersionPeer::VERSION, $key[1], Criteria::EQUAL);
291: $cton0->addAnd($cton1);
292: $this->addOr($cton0);
293: }
294:
295: return $this;
296: }
297:
298: /**
299: * Filter the query on the id column
300: *
301: * Example usage:
302: * <code>
303: * $query->filterById(1234); // WHERE id = 1234
304: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
305: * $query->filterById(array('min' => 12)); // WHERE id >= 12
306: * $query->filterById(array('max' => 12)); // WHERE id <= 12
307: * </code>
308: *
309: * @see filterByProduct()
310: *
311: * @param mixed $id The value to use as filter.
312: * Use scalar values for equality.
313: * Use array values for in_array() equivalent.
314: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
315: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
316: *
317: * @return ProductVersionQuery The current query, for fluid interface
318: */
319: public function filterById($id = null, $comparison = null)
320: {
321: if (is_array($id)) {
322: $useMinMax = false;
323: if (isset($id['min'])) {
324: $this->addUsingAlias(ProductVersionPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
325: $useMinMax = true;
326: }
327: if (isset($id['max'])) {
328: $this->addUsingAlias(ProductVersionPeer::ID, $id['max'], Criteria::LESS_EQUAL);
329: $useMinMax = true;
330: }
331: if ($useMinMax) {
332: return $this;
333: }
334: if (null === $comparison) {
335: $comparison = Criteria::IN;
336: }
337: }
338:
339: return $this->addUsingAlias(ProductVersionPeer::ID, $id, $comparison);
340: }
341:
342: /**
343: * Filter the query on the tax_rule_id column
344: *
345: * Example usage:
346: * <code>
347: * $query->filterByTaxRuleId(1234); // WHERE tax_rule_id = 1234
348: * $query->filterByTaxRuleId(array(12, 34)); // WHERE tax_rule_id IN (12, 34)
349: * $query->filterByTaxRuleId(array('min' => 12)); // WHERE tax_rule_id >= 12
350: * $query->filterByTaxRuleId(array('max' => 12)); // WHERE tax_rule_id <= 12
351: * </code>
352: *
353: * @param mixed $taxRuleId The value to use as filter.
354: * Use scalar values for equality.
355: * Use array values for in_array() equivalent.
356: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
357: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
358: *
359: * @return ProductVersionQuery The current query, for fluid interface
360: */
361: public function filterByTaxRuleId($taxRuleId = null, $comparison = null)
362: {
363: if (is_array($taxRuleId)) {
364: $useMinMax = false;
365: if (isset($taxRuleId['min'])) {
366: $this->addUsingAlias(ProductVersionPeer::TAX_RULE_ID, $taxRuleId['min'], Criteria::GREATER_EQUAL);
367: $useMinMax = true;
368: }
369: if (isset($taxRuleId['max'])) {
370: $this->addUsingAlias(ProductVersionPeer::TAX_RULE_ID, $taxRuleId['max'], Criteria::LESS_EQUAL);
371: $useMinMax = true;
372: }
373: if ($useMinMax) {
374: return $this;
375: }
376: if (null === $comparison) {
377: $comparison = Criteria::IN;
378: }
379: }
380:
381: return $this->addUsingAlias(ProductVersionPeer::TAX_RULE_ID, $taxRuleId, $comparison);
382: }
383:
384: /**
385: * Filter the query on the ref column
386: *
387: * Example usage:
388: * <code>
389: * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
390: * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
391: * </code>
392: *
393: * @param string $ref The value to use as filter.
394: * Accepts wildcards (* and % trigger a LIKE)
395: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
396: *
397: * @return ProductVersionQuery The current query, for fluid interface
398: */
399: public function filterByRef($ref = null, $comparison = null)
400: {
401: if (null === $comparison) {
402: if (is_array($ref)) {
403: $comparison = Criteria::IN;
404: } elseif (preg_match('/[\%\*]/', $ref)) {
405: $ref = str_replace('*', '%', $ref);
406: $comparison = Criteria::LIKE;
407: }
408: }
409:
410: return $this->addUsingAlias(ProductVersionPeer::REF, $ref, $comparison);
411: }
412:
413: /**
414: * Filter the query on the price column
415: *
416: * Example usage:
417: * <code>
418: * $query->filterByPrice(1234); // WHERE price = 1234
419: * $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
420: * $query->filterByPrice(array('min' => 12)); // WHERE price >= 12
421: * $query->filterByPrice(array('max' => 12)); // WHERE price <= 12
422: * </code>
423: *
424: * @param mixed $price The value to use as filter.
425: * Use scalar values for equality.
426: * Use array values for in_array() equivalent.
427: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
428: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
429: *
430: * @return ProductVersionQuery The current query, for fluid interface
431: */
432: public function filterByPrice($price = null, $comparison = null)
433: {
434: if (is_array($price)) {
435: $useMinMax = false;
436: if (isset($price['min'])) {
437: $this->addUsingAlias(ProductVersionPeer::PRICE, $price['min'], Criteria::GREATER_EQUAL);
438: $useMinMax = true;
439: }
440: if (isset($price['max'])) {
441: $this->addUsingAlias(ProductVersionPeer::PRICE, $price['max'], Criteria::LESS_EQUAL);
442: $useMinMax = true;
443: }
444: if ($useMinMax) {
445: return $this;
446: }
447: if (null === $comparison) {
448: $comparison = Criteria::IN;
449: }
450: }
451:
452: return $this->addUsingAlias(ProductVersionPeer::PRICE, $price, $comparison);
453: }
454:
455: /**
456: * Filter the query on the price2 column
457: *
458: * Example usage:
459: * <code>
460: * $query->filterByPrice2(1234); // WHERE price2 = 1234
461: * $query->filterByPrice2(array(12, 34)); // WHERE price2 IN (12, 34)
462: * $query->filterByPrice2(array('min' => 12)); // WHERE price2 >= 12
463: * $query->filterByPrice2(array('max' => 12)); // WHERE price2 <= 12
464: * </code>
465: *
466: * @param mixed $price2 The value to use as filter.
467: * Use scalar values for equality.
468: * Use array values for in_array() equivalent.
469: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
470: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
471: *
472: * @return ProductVersionQuery The current query, for fluid interface
473: */
474: public function filterByPrice2($price2 = null, $comparison = null)
475: {
476: if (is_array($price2)) {
477: $useMinMax = false;
478: if (isset($price2['min'])) {
479: $this->addUsingAlias(ProductVersionPeer::PRICE2, $price2['min'], Criteria::GREATER_EQUAL);
480: $useMinMax = true;
481: }
482: if (isset($price2['max'])) {
483: $this->addUsingAlias(ProductVersionPeer::PRICE2, $price2['max'], Criteria::LESS_EQUAL);
484: $useMinMax = true;
485: }
486: if ($useMinMax) {
487: return $this;
488: }
489: if (null === $comparison) {
490: $comparison = Criteria::IN;
491: }
492: }
493:
494: return $this->addUsingAlias(ProductVersionPeer::PRICE2, $price2, $comparison);
495: }
496:
497: /**
498: * Filter the query on the ecotax column
499: *
500: * Example usage:
501: * <code>
502: * $query->filterByEcotax(1234); // WHERE ecotax = 1234
503: * $query->filterByEcotax(array(12, 34)); // WHERE ecotax IN (12, 34)
504: * $query->filterByEcotax(array('min' => 12)); // WHERE ecotax >= 12
505: * $query->filterByEcotax(array('max' => 12)); // WHERE ecotax <= 12
506: * </code>
507: *
508: * @param mixed $ecotax The value to use as filter.
509: * Use scalar values for equality.
510: * Use array values for in_array() equivalent.
511: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
512: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
513: *
514: * @return ProductVersionQuery The current query, for fluid interface
515: */
516: public function filterByEcotax($ecotax = null, $comparison = null)
517: {
518: if (is_array($ecotax)) {
519: $useMinMax = false;
520: if (isset($ecotax['min'])) {
521: $this->addUsingAlias(ProductVersionPeer::ECOTAX, $ecotax['min'], Criteria::GREATER_EQUAL);
522: $useMinMax = true;
523: }
524: if (isset($ecotax['max'])) {
525: $this->addUsingAlias(ProductVersionPeer::ECOTAX, $ecotax['max'], Criteria::LESS_EQUAL);
526: $useMinMax = true;
527: }
528: if ($useMinMax) {
529: return $this;
530: }
531: if (null === $comparison) {
532: $comparison = Criteria::IN;
533: }
534: }
535:
536: return $this->addUsingAlias(ProductVersionPeer::ECOTAX, $ecotax, $comparison);
537: }
538:
539: /**
540: * Filter the query on the newness column
541: *
542: * Example usage:
543: * <code>
544: * $query->filterByNewness(1234); // WHERE newness = 1234
545: * $query->filterByNewness(array(12, 34)); // WHERE newness IN (12, 34)
546: * $query->filterByNewness(array('min' => 12)); // WHERE newness >= 12
547: * $query->filterByNewness(array('max' => 12)); // WHERE newness <= 12
548: * </code>
549: *
550: * @param mixed $newness The value to use as filter.
551: * Use scalar values for equality.
552: * Use array values for in_array() equivalent.
553: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
554: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
555: *
556: * @return ProductVersionQuery The current query, for fluid interface
557: */
558: public function filterByNewness($newness = null, $comparison = null)
559: {
560: if (is_array($newness)) {
561: $useMinMax = false;
562: if (isset($newness['min'])) {
563: $this->addUsingAlias(ProductVersionPeer::NEWNESS, $newness['min'], Criteria::GREATER_EQUAL);
564: $useMinMax = true;
565: }
566: if (isset($newness['max'])) {
567: $this->addUsingAlias(ProductVersionPeer::NEWNESS, $newness['max'], Criteria::LESS_EQUAL);
568: $useMinMax = true;
569: }
570: if ($useMinMax) {
571: return $this;
572: }
573: if (null === $comparison) {
574: $comparison = Criteria::IN;
575: }
576: }
577:
578: return $this->addUsingAlias(ProductVersionPeer::NEWNESS, $newness, $comparison);
579: }
580:
581: /**
582: * Filter the query on the promo column
583: *
584: * Example usage:
585: * <code>
586: * $query->filterByPromo(1234); // WHERE promo = 1234
587: * $query->filterByPromo(array(12, 34)); // WHERE promo IN (12, 34)
588: * $query->filterByPromo(array('min' => 12)); // WHERE promo >= 12
589: * $query->filterByPromo(array('max' => 12)); // WHERE promo <= 12
590: * </code>
591: *
592: * @param mixed $promo The value to use as filter.
593: * Use scalar values for equality.
594: * Use array values for in_array() equivalent.
595: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
596: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
597: *
598: * @return ProductVersionQuery The current query, for fluid interface
599: */
600: public function filterByPromo($promo = null, $comparison = null)
601: {
602: if (is_array($promo)) {
603: $useMinMax = false;
604: if (isset($promo['min'])) {
605: $this->addUsingAlias(ProductVersionPeer::PROMO, $promo['min'], Criteria::GREATER_EQUAL);
606: $useMinMax = true;
607: }
608: if (isset($promo['max'])) {
609: $this->addUsingAlias(ProductVersionPeer::PROMO, $promo['max'], Criteria::LESS_EQUAL);
610: $useMinMax = true;
611: }
612: if ($useMinMax) {
613: return $this;
614: }
615: if (null === $comparison) {
616: $comparison = Criteria::IN;
617: }
618: }
619:
620: return $this->addUsingAlias(ProductVersionPeer::PROMO, $promo, $comparison);
621: }
622:
623: /**
624: * Filter the query on the stock column
625: *
626: * Example usage:
627: * <code>
628: * $query->filterByStock(1234); // WHERE stock = 1234
629: * $query->filterByStock(array(12, 34)); // WHERE stock IN (12, 34)
630: * $query->filterByStock(array('min' => 12)); // WHERE stock >= 12
631: * $query->filterByStock(array('max' => 12)); // WHERE stock <= 12
632: * </code>
633: *
634: * @param mixed $stock The value to use as filter.
635: * Use scalar values for equality.
636: * Use array values for in_array() equivalent.
637: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
638: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
639: *
640: * @return ProductVersionQuery The current query, for fluid interface
641: */
642: public function filterByStock($stock = null, $comparison = null)
643: {
644: if (is_array($stock)) {
645: $useMinMax = false;
646: if (isset($stock['min'])) {
647: $this->addUsingAlias(ProductVersionPeer::STOCK, $stock['min'], Criteria::GREATER_EQUAL);
648: $useMinMax = true;
649: }
650: if (isset($stock['max'])) {
651: $this->addUsingAlias(ProductVersionPeer::STOCK, $stock['max'], Criteria::LESS_EQUAL);
652: $useMinMax = true;
653: }
654: if ($useMinMax) {
655: return $this;
656: }
657: if (null === $comparison) {
658: $comparison = Criteria::IN;
659: }
660: }
661:
662: return $this->addUsingAlias(ProductVersionPeer::STOCK, $stock, $comparison);
663: }
664:
665: /**
666: * Filter the query on the visible column
667: *
668: * Example usage:
669: * <code>
670: * $query->filterByVisible(1234); // WHERE visible = 1234
671: * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
672: * $query->filterByVisible(array('min' => 12)); // WHERE visible >= 12
673: * $query->filterByVisible(array('max' => 12)); // WHERE visible <= 12
674: * </code>
675: *
676: * @param mixed $visible The value to use as filter.
677: * Use scalar values for equality.
678: * Use array values for in_array() equivalent.
679: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
680: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
681: *
682: * @return ProductVersionQuery The current query, for fluid interface
683: */
684: public function filterByVisible($visible = null, $comparison = null)
685: {
686: if (is_array($visible)) {
687: $useMinMax = false;
688: if (isset($visible['min'])) {
689: $this->addUsingAlias(ProductVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
690: $useMinMax = true;
691: }
692: if (isset($visible['max'])) {
693: $this->addUsingAlias(ProductVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
694: $useMinMax = true;
695: }
696: if ($useMinMax) {
697: return $this;
698: }
699: if (null === $comparison) {
700: $comparison = Criteria::IN;
701: }
702: }
703:
704: return $this->addUsingAlias(ProductVersionPeer::VISIBLE, $visible, $comparison);
705: }
706:
707: /**
708: * Filter the query on the weight column
709: *
710: * Example usage:
711: * <code>
712: * $query->filterByWeight(1234); // WHERE weight = 1234
713: * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34)
714: * $query->filterByWeight(array('min' => 12)); // WHERE weight >= 12
715: * $query->filterByWeight(array('max' => 12)); // WHERE weight <= 12
716: * </code>
717: *
718: * @param mixed $weight The value to use as filter.
719: * Use scalar values for equality.
720: * Use array values for in_array() equivalent.
721: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
722: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
723: *
724: * @return ProductVersionQuery The current query, for fluid interface
725: */
726: public function filterByWeight($weight = null, $comparison = null)
727: {
728: if (is_array($weight)) {
729: $useMinMax = false;
730: if (isset($weight['min'])) {
731: $this->addUsingAlias(ProductVersionPeer::WEIGHT, $weight['min'], Criteria::GREATER_EQUAL);
732: $useMinMax = true;
733: }
734: if (isset($weight['max'])) {
735: $this->addUsingAlias(ProductVersionPeer::WEIGHT, $weight['max'], Criteria::LESS_EQUAL);
736: $useMinMax = true;
737: }
738: if ($useMinMax) {
739: return $this;
740: }
741: if (null === $comparison) {
742: $comparison = Criteria::IN;
743: }
744: }
745:
746: return $this->addUsingAlias(ProductVersionPeer::WEIGHT, $weight, $comparison);
747: }
748:
749: /**
750: * Filter the query on the position column
751: *
752: * Example usage:
753: * <code>
754: * $query->filterByPosition(1234); // WHERE position = 1234
755: * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
756: * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
757: * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
758: * </code>
759: *
760: * @param mixed $position The value to use as filter.
761: * Use scalar values for equality.
762: * Use array values for in_array() equivalent.
763: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
764: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
765: *
766: * @return ProductVersionQuery The current query, for fluid interface
767: */
768: public function filterByPosition($position = null, $comparison = null)
769: {
770: if (is_array($position)) {
771: $useMinMax = false;
772: if (isset($position['min'])) {
773: $this->addUsingAlias(ProductVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
774: $useMinMax = true;
775: }
776: if (isset($position['max'])) {
777: $this->addUsingAlias(ProductVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
778: $useMinMax = true;
779: }
780: if ($useMinMax) {
781: return $this;
782: }
783: if (null === $comparison) {
784: $comparison = Criteria::IN;
785: }
786: }
787:
788: return $this->addUsingAlias(ProductVersionPeer::POSITION, $position, $comparison);
789: }
790:
791: /**
792: * Filter the query on the created_at column
793: *
794: * Example usage:
795: * <code>
796: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
797: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
798: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
799: * </code>
800: *
801: * @param mixed $createdAt The value to use as filter.
802: * Values can be integers (unix timestamps), DateTime objects, or strings.
803: * Empty strings are treated as NULL.
804: * Use scalar values for equality.
805: * Use array values for in_array() equivalent.
806: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
807: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
808: *
809: * @return ProductVersionQuery The current query, for fluid interface
810: */
811: public function filterByCreatedAt($createdAt = null, $comparison = null)
812: {
813: if (is_array($createdAt)) {
814: $useMinMax = false;
815: if (isset($createdAt['min'])) {
816: $this->addUsingAlias(ProductVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
817: $useMinMax = true;
818: }
819: if (isset($createdAt['max'])) {
820: $this->addUsingAlias(ProductVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
821: $useMinMax = true;
822: }
823: if ($useMinMax) {
824: return $this;
825: }
826: if (null === $comparison) {
827: $comparison = Criteria::IN;
828: }
829: }
830:
831: return $this->addUsingAlias(ProductVersionPeer::CREATED_AT, $createdAt, $comparison);
832: }
833:
834: /**
835: * Filter the query on the updated_at column
836: *
837: * Example usage:
838: * <code>
839: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
840: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
841: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
842: * </code>
843: *
844: * @param mixed $updatedAt The value to use as filter.
845: * Values can be integers (unix timestamps), DateTime objects, or strings.
846: * Empty strings are treated as NULL.
847: * Use scalar values for equality.
848: * Use array values for in_array() equivalent.
849: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
850: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
851: *
852: * @return ProductVersionQuery The current query, for fluid interface
853: */
854: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
855: {
856: if (is_array($updatedAt)) {
857: $useMinMax = false;
858: if (isset($updatedAt['min'])) {
859: $this->addUsingAlias(ProductVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
860: $useMinMax = true;
861: }
862: if (isset($updatedAt['max'])) {
863: $this->addUsingAlias(ProductVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
864: $useMinMax = true;
865: }
866: if ($useMinMax) {
867: return $this;
868: }
869: if (null === $comparison) {
870: $comparison = Criteria::IN;
871: }
872: }
873:
874: return $this->addUsingAlias(ProductVersionPeer::UPDATED_AT, $updatedAt, $comparison);
875: }
876:
877: /**
878: * Filter the query on the version column
879: *
880: * Example usage:
881: * <code>
882: * $query->filterByVersion(1234); // WHERE version = 1234
883: * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
884: * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12
885: * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12
886: * </code>
887: *
888: * @param mixed $version The value to use as filter.
889: * Use scalar values for equality.
890: * Use array values for in_array() equivalent.
891: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
892: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
893: *
894: * @return ProductVersionQuery The current query, for fluid interface
895: */
896: public function filterByVersion($version = null, $comparison = null)
897: {
898: if (is_array($version)) {
899: $useMinMax = false;
900: if (isset($version['min'])) {
901: $this->addUsingAlias(ProductVersionPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
902: $useMinMax = true;
903: }
904: if (isset($version['max'])) {
905: $this->addUsingAlias(ProductVersionPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
906: $useMinMax = true;
907: }
908: if ($useMinMax) {
909: return $this;
910: }
911: if (null === $comparison) {
912: $comparison = Criteria::IN;
913: }
914: }
915:
916: return $this->addUsingAlias(ProductVersionPeer::VERSION, $version, $comparison);
917: }
918:
919: /**
920: * Filter the query on the version_created_at column
921: *
922: * Example usage:
923: * <code>
924: * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
925: * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
926: * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
927: * </code>
928: *
929: * @param mixed $versionCreatedAt The value to use as filter.
930: * Values can be integers (unix timestamps), DateTime objects, or strings.
931: * Empty strings are treated as NULL.
932: * Use scalar values for equality.
933: * Use array values for in_array() equivalent.
934: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
935: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
936: *
937: * @return ProductVersionQuery The current query, for fluid interface
938: */
939: public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
940: {
941: if (is_array($versionCreatedAt)) {
942: $useMinMax = false;
943: if (isset($versionCreatedAt['min'])) {
944: $this->addUsingAlias(ProductVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
945: $useMinMax = true;
946: }
947: if (isset($versionCreatedAt['max'])) {
948: $this->addUsingAlias(ProductVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
949: $useMinMax = true;
950: }
951: if ($useMinMax) {
952: return $this;
953: }
954: if (null === $comparison) {
955: $comparison = Criteria::IN;
956: }
957: }
958:
959: return $this->addUsingAlias(ProductVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
960: }
961:
962: /**
963: * Filter the query on the version_created_by column
964: *
965: * Example usage:
966: * <code>
967: * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
968: * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
969: * </code>
970: *
971: * @param string $versionCreatedBy The value to use as filter.
972: * Accepts wildcards (* and % trigger a LIKE)
973: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
974: *
975: * @return ProductVersionQuery The current query, for fluid interface
976: */
977: public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
978: {
979: if (null === $comparison) {
980: if (is_array($versionCreatedBy)) {
981: $comparison = Criteria::IN;
982: } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
983: $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
984: $comparison = Criteria::LIKE;
985: }
986: }
987:
988: return $this->addUsingAlias(ProductVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
989: }
990:
991: /**
992: * Filter the query by a related Product object
993: *
994: * @param Product|PropelObjectCollection $product The related object(s) to use as filter
995: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
996: *
997: * @return ProductVersionQuery The current query, for fluid interface
998: * @throws PropelException - if the provided filter is invalid.
999: */
1000: public function filterByProduct($product, $comparison = null)
1001: {
1002: if ($product instanceof Product) {
1003: return $this
1004: ->addUsingAlias(ProductVersionPeer::ID, $product->getId(), $comparison);
1005: } elseif ($product instanceof PropelObjectCollection) {
1006: if (null === $comparison) {
1007: $comparison = Criteria::IN;
1008: }
1009:
1010: return $this
1011: ->addUsingAlias(ProductVersionPeer::ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
1012: } else {
1013: throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
1014: }
1015: }
1016:
1017: /**
1018: * Adds a JOIN clause to the query using the Product relation
1019: *
1020: * @param string $relationAlias optional alias for the relation
1021: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1022: *
1023: * @return ProductVersionQuery The current query, for fluid interface
1024: */
1025: public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1026: {
1027: $tableMap = $this->getTableMap();
1028: $relationMap = $tableMap->getRelation('Product');
1029:
1030: // create a ModelJoin object for this join
1031: $join = new ModelJoin();
1032: $join->setJoinType($joinType);
1033: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1034: if ($previousJoin = $this->getPreviousJoin()) {
1035: $join->setPreviousJoin($previousJoin);
1036: }
1037:
1038: // add the ModelJoin to the current object
1039: if ($relationAlias) {
1040: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1041: $this->addJoinObject($join, $relationAlias);
1042: } else {
1043: $this->addJoinObject($join, 'Product');
1044: }
1045:
1046: return $this;
1047: }
1048:
1049: /**
1050: * Use the Product relation Product object
1051: *
1052: * @see useQuery()
1053: *
1054: * @param string $relationAlias optional alias for the relation,
1055: * to be used as main alias in the secondary query
1056: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1057: *
1058: * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
1059: */
1060: public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1061: {
1062: return $this
1063: ->joinProduct($relationAlias, $joinType)
1064: ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
1065: }
1066:
1067: /**
1068: * Exclude object from result
1069: *
1070: * @param ProductVersion $productVersion Object to remove from the list of results
1071: *
1072: * @return ProductVersionQuery The current query, for fluid interface
1073: */
1074: public function prune($productVersion = null)
1075: {
1076: if ($productVersion) {
1077: $this->addCond('pruneCond0', $this->getAliasedColName(ProductVersionPeer::ID), $productVersion->getId(), Criteria::NOT_EQUAL);
1078: $this->addCond('pruneCond1', $this->getAliasedColName(ProductVersionPeer::VERSION), $productVersion->getVersion(), Criteria::NOT_EQUAL);
1079: $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
1080: }
1081:
1082: return $this;
1083: }
1084:
1085: }
1086: