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\Order;
16: use Thelia\Model\OrderFeature;
17: use Thelia\Model\OrderProduct;
18: use Thelia\Model\OrderProductPeer;
19: use Thelia\Model\OrderProductQuery;
20:
21: /**
22: * Base class that represents a query for the 'order_product' table.
23: *
24: *
25: *
26: * @method OrderProductQuery orderById($order = Criteria::ASC) Order by the id column
27: * @method OrderProductQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
28: * @method OrderProductQuery orderByProductRef($order = Criteria::ASC) Order by the product_ref column
29: * @method OrderProductQuery orderByTitle($order = Criteria::ASC) Order by the title column
30: * @method OrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column
31: * @method OrderProductQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
32: * @method OrderProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
33: * @method OrderProductQuery orderByPrice($order = Criteria::ASC) Order by the price column
34: * @method OrderProductQuery orderByTax($order = Criteria::ASC) Order by the tax column
35: * @method OrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
36: * @method OrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
37: * @method OrderProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
38: *
39: * @method OrderProductQuery groupById() Group by the id column
40: * @method OrderProductQuery groupByOrderId() Group by the order_id column
41: * @method OrderProductQuery groupByProductRef() Group by the product_ref column
42: * @method OrderProductQuery groupByTitle() Group by the title column
43: * @method OrderProductQuery groupByDescription() Group by the description column
44: * @method OrderProductQuery groupByChapo() Group by the chapo column
45: * @method OrderProductQuery groupByQuantity() Group by the quantity column
46: * @method OrderProductQuery groupByPrice() Group by the price column
47: * @method OrderProductQuery groupByTax() Group by the tax column
48: * @method OrderProductQuery groupByParent() Group by the parent column
49: * @method OrderProductQuery groupByCreatedAt() Group by the created_at column
50: * @method OrderProductQuery groupByUpdatedAt() Group by the updated_at column
51: *
52: * @method OrderProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
53: * @method OrderProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
54: * @method OrderProductQuery innerJoin($relation) Adds a INNER JOIN clause to the query
55: *
56: * @method OrderProductQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
57: * @method OrderProductQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
58: * @method OrderProductQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
59: *
60: * @method OrderProductQuery leftJoinOrderFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderFeature relation
61: * @method OrderProductQuery rightJoinOrderFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderFeature relation
62: * @method OrderProductQuery innerJoinOrderFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderFeature relation
63: *
64: * @method OrderProduct findOne(PropelPDO $con = null) Return the first OrderProduct matching the query
65: * @method OrderProduct findOneOrCreate(PropelPDO $con = null) Return the first OrderProduct matching the query, or a new OrderProduct object populated from the query conditions when no match is found
66: *
67: * @method OrderProduct findOneByOrderId(int $order_id) Return the first OrderProduct filtered by the order_id column
68: * @method OrderProduct findOneByProductRef(string $product_ref) Return the first OrderProduct filtered by the product_ref column
69: * @method OrderProduct findOneByTitle(string $title) Return the first OrderProduct filtered by the title column
70: * @method OrderProduct findOneByDescription(string $description) Return the first OrderProduct filtered by the description column
71: * @method OrderProduct findOneByChapo(string $chapo) Return the first OrderProduct filtered by the chapo column
72: * @method OrderProduct findOneByQuantity(double $quantity) Return the first OrderProduct filtered by the quantity column
73: * @method OrderProduct findOneByPrice(double $price) Return the first OrderProduct filtered by the price column
74: * @method OrderProduct findOneByTax(double $tax) Return the first OrderProduct filtered by the tax column
75: * @method OrderProduct findOneByParent(int $parent) Return the first OrderProduct filtered by the parent column
76: * @method OrderProduct findOneByCreatedAt(string $created_at) Return the first OrderProduct filtered by the created_at column
77: * @method OrderProduct findOneByUpdatedAt(string $updated_at) Return the first OrderProduct filtered by the updated_at column
78: *
79: * @method array findById(int $id) Return OrderProduct objects filtered by the id column
80: * @method array findByOrderId(int $order_id) Return OrderProduct objects filtered by the order_id column
81: * @method array findByProductRef(string $product_ref) Return OrderProduct objects filtered by the product_ref column
82: * @method array findByTitle(string $title) Return OrderProduct objects filtered by the title column
83: * @method array findByDescription(string $description) Return OrderProduct objects filtered by the description column
84: * @method array findByChapo(string $chapo) Return OrderProduct objects filtered by the chapo column
85: * @method array findByQuantity(double $quantity) Return OrderProduct objects filtered by the quantity column
86: * @method array findByPrice(double $price) Return OrderProduct objects filtered by the price column
87: * @method array findByTax(double $tax) Return OrderProduct objects filtered by the tax column
88: * @method array findByParent(int $parent) Return OrderProduct objects filtered by the parent column
89: * @method array findByCreatedAt(string $created_at) Return OrderProduct objects filtered by the created_at column
90: * @method array findByUpdatedAt(string $updated_at) Return OrderProduct objects filtered by the updated_at column
91: *
92: * @package propel.generator.Thelia.Model.om
93: */
94: abstract class BaseOrderProductQuery extends ModelCriteria
95: {
96: /**
97: * Initializes internal state of BaseOrderProductQuery object.
98: *
99: * @param string $dbName The dabase name
100: * @param string $modelName The phpName of a model, e.g. 'Book'
101: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
102: */
103: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\OrderProduct', $modelAlias = null)
104: {
105: parent::__construct($dbName, $modelName, $modelAlias);
106: }
107:
108: /**
109: * Returns a new OrderProductQuery object.
110: *
111: * @param string $modelAlias The alias of a model in the query
112: * @param OrderProductQuery|Criteria $criteria Optional Criteria to build the query from
113: *
114: * @return OrderProductQuery
115: */
116: public static function create($modelAlias = null, $criteria = null)
117: {
118: if ($criteria instanceof OrderProductQuery) {
119: return $criteria;
120: }
121: $query = new OrderProductQuery();
122: if (null !== $modelAlias) {
123: $query->setModelAlias($modelAlias);
124: }
125: if ($criteria instanceof Criteria) {
126: $query->mergeWith($criteria);
127: }
128:
129: return $query;
130: }
131:
132: /**
133: * Find object by primary key.
134: * Propel uses the instance pool to skip the database if the object exists.
135: * Go fast if the query is untouched.
136: *
137: * <code>
138: * $obj = $c->findPk(12, $con);
139: * </code>
140: *
141: * @param mixed $key Primary key to use for the query
142: * @param PropelPDO $con an optional connection object
143: *
144: * @return OrderProduct|OrderProduct[]|mixed the result, formatted by the current formatter
145: */
146: public function findPk($key, $con = null)
147: {
148: if ($key === null) {
149: return null;
150: }
151: if ((null !== ($obj = OrderProductPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
152: // the object is alredy in the instance pool
153: return $obj;
154: }
155: if ($con === null) {
156: $con = Propel::getConnection(OrderProductPeer::DATABASE_NAME, Propel::CONNECTION_READ);
157: }
158: $this->basePreSelect($con);
159: if ($this->formatter || $this->modelAlias || $this->with || $this->select
160: || $this->selectColumns || $this->asColumns || $this->selectModifiers
161: || $this->map || $this->having || $this->joins) {
162: return $this->findPkComplex($key, $con);
163: } else {
164: return $this->findPkSimple($key, $con);
165: }
166: }
167:
168: /**
169: * Alias of findPk to use instance pooling
170: *
171: * @param mixed $key Primary key to use for the query
172: * @param PropelPDO $con A connection object
173: *
174: * @return OrderProduct A model object, or null if the key is not found
175: * @throws PropelException
176: */
177: public function findOneById($key, $con = null)
178: {
179: return $this->findPk($key, $con);
180: }
181:
182: /**
183: * Find object by primary key using raw SQL to go fast.
184: * Bypass doSelect() and the object formatter by using generated code.
185: *
186: * @param mixed $key Primary key to use for the query
187: * @param PropelPDO $con A connection object
188: *
189: * @return OrderProduct A model object, or null if the key is not found
190: * @throws PropelException
191: */
192: protected function findPkSimple($key, $con)
193: {
194: $sql = 'SELECT `id`, `order_id`, `product_ref`, `title`, `description`, `chapo`, `quantity`, `price`, `tax`, `parent`, `created_at`, `updated_at` FROM `order_product` WHERE `id` = :p0';
195: try {
196: $stmt = $con->prepare($sql);
197: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
198: $stmt->execute();
199: } catch (Exception $e) {
200: Propel::log($e->getMessage(), Propel::LOG_ERR);
201: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
202: }
203: $obj = null;
204: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
205: $obj = new OrderProduct();
206: $obj->hydrate($row);
207: OrderProductPeer::addInstanceToPool($obj, (string) $key);
208: }
209: $stmt->closeCursor();
210:
211: return $obj;
212: }
213:
214: /**
215: * Find object by primary key.
216: *
217: * @param mixed $key Primary key to use for the query
218: * @param PropelPDO $con A connection object
219: *
220: * @return OrderProduct|OrderProduct[]|mixed the result, formatted by the current formatter
221: */
222: protected function findPkComplex($key, $con)
223: {
224: // As the query uses a PK condition, no limit(1) is necessary.
225: $criteria = $this->isKeepQuery() ? clone $this : $this;
226: $stmt = $criteria
227: ->filterByPrimaryKey($key)
228: ->doSelect($con);
229:
230: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
231: }
232:
233: /**
234: * Find objects by primary key
235: * <code>
236: * $objs = $c->findPks(array(12, 56, 832), $con);
237: * </code>
238: * @param array $keys Primary keys to use for the query
239: * @param PropelPDO $con an optional connection object
240: *
241: * @return PropelObjectCollection|OrderProduct[]|mixed the list of results, formatted by the current formatter
242: */
243: public function findPks($keys, $con = null)
244: {
245: if ($con === null) {
246: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
247: }
248: $this->basePreSelect($con);
249: $criteria = $this->isKeepQuery() ? clone $this : $this;
250: $stmt = $criteria
251: ->filterByPrimaryKeys($keys)
252: ->doSelect($con);
253:
254: return $criteria->getFormatter()->init($criteria)->format($stmt);
255: }
256:
257: /**
258: * Filter the query by primary key
259: *
260: * @param mixed $key Primary key to use for the query
261: *
262: * @return OrderProductQuery The current query, for fluid interface
263: */
264: public function filterByPrimaryKey($key)
265: {
266:
267: return $this->addUsingAlias(OrderProductPeer::ID, $key, Criteria::EQUAL);
268: }
269:
270: /**
271: * Filter the query by a list of primary keys
272: *
273: * @param array $keys The list of primary key to use for the query
274: *
275: * @return OrderProductQuery The current query, for fluid interface
276: */
277: public function filterByPrimaryKeys($keys)
278: {
279:
280: return $this->addUsingAlias(OrderProductPeer::ID, $keys, Criteria::IN);
281: }
282:
283: /**
284: * Filter the query on the id column
285: *
286: * Example usage:
287: * <code>
288: * $query->filterById(1234); // WHERE id = 1234
289: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
290: * $query->filterById(array('min' => 12)); // WHERE id >= 12
291: * $query->filterById(array('max' => 12)); // WHERE id <= 12
292: * </code>
293: *
294: * @param mixed $id The value to use as filter.
295: * Use scalar values for equality.
296: * Use array values for in_array() equivalent.
297: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
298: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
299: *
300: * @return OrderProductQuery The current query, for fluid interface
301: */
302: public function filterById($id = null, $comparison = null)
303: {
304: if (is_array($id)) {
305: $useMinMax = false;
306: if (isset($id['min'])) {
307: $this->addUsingAlias(OrderProductPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
308: $useMinMax = true;
309: }
310: if (isset($id['max'])) {
311: $this->addUsingAlias(OrderProductPeer::ID, $id['max'], Criteria::LESS_EQUAL);
312: $useMinMax = true;
313: }
314: if ($useMinMax) {
315: return $this;
316: }
317: if (null === $comparison) {
318: $comparison = Criteria::IN;
319: }
320: }
321:
322: return $this->addUsingAlias(OrderProductPeer::ID, $id, $comparison);
323: }
324:
325: /**
326: * Filter the query on the order_id column
327: *
328: * Example usage:
329: * <code>
330: * $query->filterByOrderId(1234); // WHERE order_id = 1234
331: * $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
332: * $query->filterByOrderId(array('min' => 12)); // WHERE order_id >= 12
333: * $query->filterByOrderId(array('max' => 12)); // WHERE order_id <= 12
334: * </code>
335: *
336: * @see filterByOrder()
337: *
338: * @param mixed $orderId The value to use as filter.
339: * Use scalar values for equality.
340: * Use array values for in_array() equivalent.
341: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
342: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
343: *
344: * @return OrderProductQuery The current query, for fluid interface
345: */
346: public function filterByOrderId($orderId = null, $comparison = null)
347: {
348: if (is_array($orderId)) {
349: $useMinMax = false;
350: if (isset($orderId['min'])) {
351: $this->addUsingAlias(OrderProductPeer::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
352: $useMinMax = true;
353: }
354: if (isset($orderId['max'])) {
355: $this->addUsingAlias(OrderProductPeer::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
356: $useMinMax = true;
357: }
358: if ($useMinMax) {
359: return $this;
360: }
361: if (null === $comparison) {
362: $comparison = Criteria::IN;
363: }
364: }
365:
366: return $this->addUsingAlias(OrderProductPeer::ORDER_ID, $orderId, $comparison);
367: }
368:
369: /**
370: * Filter the query on the product_ref column
371: *
372: * Example usage:
373: * <code>
374: * $query->filterByProductRef('fooValue'); // WHERE product_ref = 'fooValue'
375: * $query->filterByProductRef('%fooValue%'); // WHERE product_ref LIKE '%fooValue%'
376: * </code>
377: *
378: * @param string $productRef The value to use as filter.
379: * Accepts wildcards (* and % trigger a LIKE)
380: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
381: *
382: * @return OrderProductQuery The current query, for fluid interface
383: */
384: public function filterByProductRef($productRef = null, $comparison = null)
385: {
386: if (null === $comparison) {
387: if (is_array($productRef)) {
388: $comparison = Criteria::IN;
389: } elseif (preg_match('/[\%\*]/', $productRef)) {
390: $productRef = str_replace('*', '%', $productRef);
391: $comparison = Criteria::LIKE;
392: }
393: }
394:
395: return $this->addUsingAlias(OrderProductPeer::PRODUCT_REF, $productRef, $comparison);
396: }
397:
398: /**
399: * Filter the query on the title column
400: *
401: * Example usage:
402: * <code>
403: * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
404: * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
405: * </code>
406: *
407: * @param string $title The value to use as filter.
408: * Accepts wildcards (* and % trigger a LIKE)
409: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
410: *
411: * @return OrderProductQuery The current query, for fluid interface
412: */
413: public function filterByTitle($title = null, $comparison = null)
414: {
415: if (null === $comparison) {
416: if (is_array($title)) {
417: $comparison = Criteria::IN;
418: } elseif (preg_match('/[\%\*]/', $title)) {
419: $title = str_replace('*', '%', $title);
420: $comparison = Criteria::LIKE;
421: }
422: }
423:
424: return $this->addUsingAlias(OrderProductPeer::TITLE, $title, $comparison);
425: }
426:
427: /**
428: * Filter the query on the description column
429: *
430: * Example usage:
431: * <code>
432: * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
433: * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
434: * </code>
435: *
436: * @param string $description The value to use as filter.
437: * Accepts wildcards (* and % trigger a LIKE)
438: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
439: *
440: * @return OrderProductQuery The current query, for fluid interface
441: */
442: public function filterByDescription($description = null, $comparison = null)
443: {
444: if (null === $comparison) {
445: if (is_array($description)) {
446: $comparison = Criteria::IN;
447: } elseif (preg_match('/[\%\*]/', $description)) {
448: $description = str_replace('*', '%', $description);
449: $comparison = Criteria::LIKE;
450: }
451: }
452:
453: return $this->addUsingAlias(OrderProductPeer::DESCRIPTION, $description, $comparison);
454: }
455:
456: /**
457: * Filter the query on the chapo column
458: *
459: * Example usage:
460: * <code>
461: * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
462: * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
463: * </code>
464: *
465: * @param string $chapo The value to use as filter.
466: * Accepts wildcards (* and % trigger a LIKE)
467: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
468: *
469: * @return OrderProductQuery The current query, for fluid interface
470: */
471: public function filterByChapo($chapo = null, $comparison = null)
472: {
473: if (null === $comparison) {
474: if (is_array($chapo)) {
475: $comparison = Criteria::IN;
476: } elseif (preg_match('/[\%\*]/', $chapo)) {
477: $chapo = str_replace('*', '%', $chapo);
478: $comparison = Criteria::LIKE;
479: }
480: }
481:
482: return $this->addUsingAlias(OrderProductPeer::CHAPO, $chapo, $comparison);
483: }
484:
485: /**
486: * Filter the query on the quantity column
487: *
488: * Example usage:
489: * <code>
490: * $query->filterByQuantity(1234); // WHERE quantity = 1234
491: * $query->filterByQuantity(array(12, 34)); // WHERE quantity IN (12, 34)
492: * $query->filterByQuantity(array('min' => 12)); // WHERE quantity >= 12
493: * $query->filterByQuantity(array('max' => 12)); // WHERE quantity <= 12
494: * </code>
495: *
496: * @param mixed $quantity The value to use as filter.
497: * Use scalar values for equality.
498: * Use array values for in_array() equivalent.
499: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
500: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
501: *
502: * @return OrderProductQuery The current query, for fluid interface
503: */
504: public function filterByQuantity($quantity = null, $comparison = null)
505: {
506: if (is_array($quantity)) {
507: $useMinMax = false;
508: if (isset($quantity['min'])) {
509: $this->addUsingAlias(OrderProductPeer::QUANTITY, $quantity['min'], Criteria::GREATER_EQUAL);
510: $useMinMax = true;
511: }
512: if (isset($quantity['max'])) {
513: $this->addUsingAlias(OrderProductPeer::QUANTITY, $quantity['max'], Criteria::LESS_EQUAL);
514: $useMinMax = true;
515: }
516: if ($useMinMax) {
517: return $this;
518: }
519: if (null === $comparison) {
520: $comparison = Criteria::IN;
521: }
522: }
523:
524: return $this->addUsingAlias(OrderProductPeer::QUANTITY, $quantity, $comparison);
525: }
526:
527: /**
528: * Filter the query on the price column
529: *
530: * Example usage:
531: * <code>
532: * $query->filterByPrice(1234); // WHERE price = 1234
533: * $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
534: * $query->filterByPrice(array('min' => 12)); // WHERE price >= 12
535: * $query->filterByPrice(array('max' => 12)); // WHERE price <= 12
536: * </code>
537: *
538: * @param mixed $price The value to use as filter.
539: * Use scalar values for equality.
540: * Use array values for in_array() equivalent.
541: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
542: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
543: *
544: * @return OrderProductQuery The current query, for fluid interface
545: */
546: public function filterByPrice($price = null, $comparison = null)
547: {
548: if (is_array($price)) {
549: $useMinMax = false;
550: if (isset($price['min'])) {
551: $this->addUsingAlias(OrderProductPeer::PRICE, $price['min'], Criteria::GREATER_EQUAL);
552: $useMinMax = true;
553: }
554: if (isset($price['max'])) {
555: $this->addUsingAlias(OrderProductPeer::PRICE, $price['max'], Criteria::LESS_EQUAL);
556: $useMinMax = true;
557: }
558: if ($useMinMax) {
559: return $this;
560: }
561: if (null === $comparison) {
562: $comparison = Criteria::IN;
563: }
564: }
565:
566: return $this->addUsingAlias(OrderProductPeer::PRICE, $price, $comparison);
567: }
568:
569: /**
570: * Filter the query on the tax column
571: *
572: * Example usage:
573: * <code>
574: * $query->filterByTax(1234); // WHERE tax = 1234
575: * $query->filterByTax(array(12, 34)); // WHERE tax IN (12, 34)
576: * $query->filterByTax(array('min' => 12)); // WHERE tax >= 12
577: * $query->filterByTax(array('max' => 12)); // WHERE tax <= 12
578: * </code>
579: *
580: * @param mixed $tax The value to use as filter.
581: * Use scalar values for equality.
582: * Use array values for in_array() equivalent.
583: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
584: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
585: *
586: * @return OrderProductQuery The current query, for fluid interface
587: */
588: public function filterByTax($tax = null, $comparison = null)
589: {
590: if (is_array($tax)) {
591: $useMinMax = false;
592: if (isset($tax['min'])) {
593: $this->addUsingAlias(OrderProductPeer::TAX, $tax['min'], Criteria::GREATER_EQUAL);
594: $useMinMax = true;
595: }
596: if (isset($tax['max'])) {
597: $this->addUsingAlias(OrderProductPeer::TAX, $tax['max'], Criteria::LESS_EQUAL);
598: $useMinMax = true;
599: }
600: if ($useMinMax) {
601: return $this;
602: }
603: if (null === $comparison) {
604: $comparison = Criteria::IN;
605: }
606: }
607:
608: return $this->addUsingAlias(OrderProductPeer::TAX, $tax, $comparison);
609: }
610:
611: /**
612: * Filter the query on the parent column
613: *
614: * Example usage:
615: * <code>
616: * $query->filterByParent(1234); // WHERE parent = 1234
617: * $query->filterByParent(array(12, 34)); // WHERE parent IN (12, 34)
618: * $query->filterByParent(array('min' => 12)); // WHERE parent >= 12
619: * $query->filterByParent(array('max' => 12)); // WHERE parent <= 12
620: * </code>
621: *
622: * @param mixed $parent The value to use as filter.
623: * Use scalar values for equality.
624: * Use array values for in_array() equivalent.
625: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
626: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
627: *
628: * @return OrderProductQuery The current query, for fluid interface
629: */
630: public function filterByParent($parent = null, $comparison = null)
631: {
632: if (is_array($parent)) {
633: $useMinMax = false;
634: if (isset($parent['min'])) {
635: $this->addUsingAlias(OrderProductPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL);
636: $useMinMax = true;
637: }
638: if (isset($parent['max'])) {
639: $this->addUsingAlias(OrderProductPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL);
640: $useMinMax = true;
641: }
642: if ($useMinMax) {
643: return $this;
644: }
645: if (null === $comparison) {
646: $comparison = Criteria::IN;
647: }
648: }
649:
650: return $this->addUsingAlias(OrderProductPeer::PARENT, $parent, $comparison);
651: }
652:
653: /**
654: * Filter the query on the created_at column
655: *
656: * Example usage:
657: * <code>
658: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
659: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
660: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
661: * </code>
662: *
663: * @param mixed $createdAt The value to use as filter.
664: * Values can be integers (unix timestamps), DateTime objects, or strings.
665: * Empty strings are treated as NULL.
666: * Use scalar values for equality.
667: * Use array values for in_array() equivalent.
668: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
669: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
670: *
671: * @return OrderProductQuery The current query, for fluid interface
672: */
673: public function filterByCreatedAt($createdAt = null, $comparison = null)
674: {
675: if (is_array($createdAt)) {
676: $useMinMax = false;
677: if (isset($createdAt['min'])) {
678: $this->addUsingAlias(OrderProductPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
679: $useMinMax = true;
680: }
681: if (isset($createdAt['max'])) {
682: $this->addUsingAlias(OrderProductPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
683: $useMinMax = true;
684: }
685: if ($useMinMax) {
686: return $this;
687: }
688: if (null === $comparison) {
689: $comparison = Criteria::IN;
690: }
691: }
692:
693: return $this->addUsingAlias(OrderProductPeer::CREATED_AT, $createdAt, $comparison);
694: }
695:
696: /**
697: * Filter the query on the updated_at column
698: *
699: * Example usage:
700: * <code>
701: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
702: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
703: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
704: * </code>
705: *
706: * @param mixed $updatedAt The value to use as filter.
707: * Values can be integers (unix timestamps), DateTime objects, or strings.
708: * Empty strings are treated as NULL.
709: * Use scalar values for equality.
710: * Use array values for in_array() equivalent.
711: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
712: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
713: *
714: * @return OrderProductQuery The current query, for fluid interface
715: */
716: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
717: {
718: if (is_array($updatedAt)) {
719: $useMinMax = false;
720: if (isset($updatedAt['min'])) {
721: $this->addUsingAlias(OrderProductPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
722: $useMinMax = true;
723: }
724: if (isset($updatedAt['max'])) {
725: $this->addUsingAlias(OrderProductPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
726: $useMinMax = true;
727: }
728: if ($useMinMax) {
729: return $this;
730: }
731: if (null === $comparison) {
732: $comparison = Criteria::IN;
733: }
734: }
735:
736: return $this->addUsingAlias(OrderProductPeer::UPDATED_AT, $updatedAt, $comparison);
737: }
738:
739: /**
740: * Filter the query by a related Order object
741: *
742: * @param Order|PropelObjectCollection $order The related object(s) to use as filter
743: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
744: *
745: * @return OrderProductQuery The current query, for fluid interface
746: * @throws PropelException - if the provided filter is invalid.
747: */
748: public function filterByOrder($order, $comparison = null)
749: {
750: if ($order instanceof Order) {
751: return $this
752: ->addUsingAlias(OrderProductPeer::ORDER_ID, $order->getId(), $comparison);
753: } elseif ($order instanceof PropelObjectCollection) {
754: if (null === $comparison) {
755: $comparison = Criteria::IN;
756: }
757:
758: return $this
759: ->addUsingAlias(OrderProductPeer::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
760: } else {
761: throw new PropelException('filterByOrder() only accepts arguments of type Order or PropelCollection');
762: }
763: }
764:
765: /**
766: * Adds a JOIN clause to the query using the Order relation
767: *
768: * @param string $relationAlias optional alias for the relation
769: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
770: *
771: * @return OrderProductQuery The current query, for fluid interface
772: */
773: public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
774: {
775: $tableMap = $this->getTableMap();
776: $relationMap = $tableMap->getRelation('Order');
777:
778: // create a ModelJoin object for this join
779: $join = new ModelJoin();
780: $join->setJoinType($joinType);
781: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
782: if ($previousJoin = $this->getPreviousJoin()) {
783: $join->setPreviousJoin($previousJoin);
784: }
785:
786: // add the ModelJoin to the current object
787: if ($relationAlias) {
788: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
789: $this->addJoinObject($join, $relationAlias);
790: } else {
791: $this->addJoinObject($join, 'Order');
792: }
793:
794: return $this;
795: }
796:
797: /**
798: * Use the Order relation Order object
799: *
800: * @see useQuery()
801: *
802: * @param string $relationAlias optional alias for the relation,
803: * to be used as main alias in the secondary query
804: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
805: *
806: * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
807: */
808: public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
809: {
810: return $this
811: ->joinOrder($relationAlias, $joinType)
812: ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
813: }
814:
815: /**
816: * Filter the query by a related OrderFeature object
817: *
818: * @param OrderFeature|PropelObjectCollection $orderFeature the related object to use as filter
819: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
820: *
821: * @return OrderProductQuery The current query, for fluid interface
822: * @throws PropelException - if the provided filter is invalid.
823: */
824: public function filterByOrderFeature($orderFeature, $comparison = null)
825: {
826: if ($orderFeature instanceof OrderFeature) {
827: return $this
828: ->addUsingAlias(OrderProductPeer::ID, $orderFeature->getOrderProductId(), $comparison);
829: } elseif ($orderFeature instanceof PropelObjectCollection) {
830: return $this
831: ->useOrderFeatureQuery()
832: ->filterByPrimaryKeys($orderFeature->getPrimaryKeys())
833: ->endUse();
834: } else {
835: throw new PropelException('filterByOrderFeature() only accepts arguments of type OrderFeature or PropelCollection');
836: }
837: }
838:
839: /**
840: * Adds a JOIN clause to the query using the OrderFeature relation
841: *
842: * @param string $relationAlias optional alias for the relation
843: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
844: *
845: * @return OrderProductQuery The current query, for fluid interface
846: */
847: public function joinOrderFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
848: {
849: $tableMap = $this->getTableMap();
850: $relationMap = $tableMap->getRelation('OrderFeature');
851:
852: // create a ModelJoin object for this join
853: $join = new ModelJoin();
854: $join->setJoinType($joinType);
855: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
856: if ($previousJoin = $this->getPreviousJoin()) {
857: $join->setPreviousJoin($previousJoin);
858: }
859:
860: // add the ModelJoin to the current object
861: if ($relationAlias) {
862: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
863: $this->addJoinObject($join, $relationAlias);
864: } else {
865: $this->addJoinObject($join, 'OrderFeature');
866: }
867:
868: return $this;
869: }
870:
871: /**
872: * Use the OrderFeature relation OrderFeature object
873: *
874: * @see useQuery()
875: *
876: * @param string $relationAlias optional alias for the relation,
877: * to be used as main alias in the secondary query
878: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
879: *
880: * @return \Thelia\Model\OrderFeatureQuery A secondary query class using the current class as primary query
881: */
882: public function useOrderFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
883: {
884: return $this
885: ->joinOrderFeature($relationAlias, $joinType)
886: ->useQuery($relationAlias ? $relationAlias : 'OrderFeature', '\Thelia\Model\OrderFeatureQuery');
887: }
888:
889: /**
890: * Exclude object from result
891: *
892: * @param OrderProduct $orderProduct Object to remove from the list of results
893: *
894: * @return OrderProductQuery The current query, for fluid interface
895: */
896: public function prune($orderProduct = null)
897: {
898: if ($orderProduct) {
899: $this->addUsingAlias(OrderProductPeer::ID, $orderProduct->getId(), Criteria::NOT_EQUAL);
900: }
901:
902: return $this;
903: }
904:
905: // timestampable behavior
906:
907: /**
908: * Filter by the latest updated
909: *
910: * @param int $nbDays Maximum age of the latest update in days
911: *
912: * @return OrderProductQuery The current query, for fluid interface
913: */
914: public function recentlyUpdated($nbDays = 7)
915: {
916: return $this->addUsingAlias(OrderProductPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
917: }
918:
919: /**
920: * Order by update date desc
921: *
922: * @return OrderProductQuery The current query, for fluid interface
923: */
924: public function lastUpdatedFirst()
925: {
926: return $this->addDescendingOrderByColumn(OrderProductPeer::UPDATED_AT);
927: }
928:
929: /**
930: * Order by update date asc
931: *
932: * @return OrderProductQuery The current query, for fluid interface
933: */
934: public function firstUpdatedFirst()
935: {
936: return $this->addAscendingOrderByColumn(OrderProductPeer::UPDATED_AT);
937: }
938:
939: /**
940: * Filter by the latest created
941: *
942: * @param int $nbDays Maximum age of in days
943: *
944: * @return OrderProductQuery The current query, for fluid interface
945: */
946: public function recentlyCreated($nbDays = 7)
947: {
948: return $this->addUsingAlias(OrderProductPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
949: }
950:
951: /**
952: * Order by create date desc
953: *
954: * @return OrderProductQuery The current query, for fluid interface
955: */
956: public function lastCreatedFirst()
957: {
958: return $this->addDescendingOrderByColumn(OrderProductPeer::CREATED_AT);
959: }
960:
961: /**
962: * Order by create date asc
963: *
964: * @return OrderProductQuery The current query, for fluid interface
965: */
966: public function firstCreatedFirst()
967: {
968: return $this->addAscendingOrderByColumn(OrderProductPeer::CREATED_AT);
969: }
970: }
971: