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\CouponOrder;
16: use Thelia\Model\Currency;
17: use Thelia\Model\Customer;
18: use Thelia\Model\Order;
19: use Thelia\Model\OrderAddress;
20: use Thelia\Model\OrderPeer;
21: use Thelia\Model\OrderProduct;
22: use Thelia\Model\OrderQuery;
23: use Thelia\Model\OrderStatus;
24:
25: /**
26: * Base class that represents a query for the 'order' table.
27: *
28: *
29: *
30: * @method OrderQuery orderById($order = Criteria::ASC) Order by the id column
31: * @method OrderQuery orderByRef($order = Criteria::ASC) Order by the ref column
32: * @method OrderQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
33: * @method OrderQuery orderByAddressInvoice($order = Criteria::ASC) Order by the address_invoice column
34: * @method OrderQuery orderByAddressDelivery($order = Criteria::ASC) Order by the address_delivery column
35: * @method OrderQuery orderByInvoiceDate($order = Criteria::ASC) Order by the invoice_date column
36: * @method OrderQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
37: * @method OrderQuery orderByCurrencyRate($order = Criteria::ASC) Order by the currency_rate column
38: * @method OrderQuery orderByTransaction($order = Criteria::ASC) Order by the transaction column
39: * @method OrderQuery orderByDeliveryNum($order = Criteria::ASC) Order by the delivery_num column
40: * @method OrderQuery orderByInvoice($order = Criteria::ASC) Order by the invoice column
41: * @method OrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column
42: * @method OrderQuery orderByPayment($order = Criteria::ASC) Order by the payment column
43: * @method OrderQuery orderByCarrier($order = Criteria::ASC) Order by the carrier column
44: * @method OrderQuery orderByStatusId($order = Criteria::ASC) Order by the status_id column
45: * @method OrderQuery orderByLang($order = Criteria::ASC) Order by the lang column
46: * @method OrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
47: * @method OrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
48: *
49: * @method OrderQuery groupById() Group by the id column
50: * @method OrderQuery groupByRef() Group by the ref column
51: * @method OrderQuery groupByCustomerId() Group by the customer_id column
52: * @method OrderQuery groupByAddressInvoice() Group by the address_invoice column
53: * @method OrderQuery groupByAddressDelivery() Group by the address_delivery column
54: * @method OrderQuery groupByInvoiceDate() Group by the invoice_date column
55: * @method OrderQuery groupByCurrencyId() Group by the currency_id column
56: * @method OrderQuery groupByCurrencyRate() Group by the currency_rate column
57: * @method OrderQuery groupByTransaction() Group by the transaction column
58: * @method OrderQuery groupByDeliveryNum() Group by the delivery_num column
59: * @method OrderQuery groupByInvoice() Group by the invoice column
60: * @method OrderQuery groupByPostage() Group by the postage column
61: * @method OrderQuery groupByPayment() Group by the payment column
62: * @method OrderQuery groupByCarrier() Group by the carrier column
63: * @method OrderQuery groupByStatusId() Group by the status_id column
64: * @method OrderQuery groupByLang() Group by the lang column
65: * @method OrderQuery groupByCreatedAt() Group by the created_at column
66: * @method OrderQuery groupByUpdatedAt() Group by the updated_at column
67: *
68: * @method OrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
69: * @method OrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
70: * @method OrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
71: *
72: * @method OrderQuery leftJoinCurrency($relationAlias = null) Adds a LEFT JOIN clause to the query using the Currency relation
73: * @method OrderQuery rightJoinCurrency($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Currency relation
74: * @method OrderQuery innerJoinCurrency($relationAlias = null) Adds a INNER JOIN clause to the query using the Currency relation
75: *
76: * @method OrderQuery leftJoinCustomer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Customer relation
77: * @method OrderQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
78: * @method OrderQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
79: *
80: * @method OrderQuery leftJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation
81: * @method OrderQuery rightJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation
82: * @method OrderQuery innerJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation
83: *
84: * @method OrderQuery leftJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation
85: * @method OrderQuery rightJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation
86: * @method OrderQuery innerJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation
87: *
88: * @method OrderQuery leftJoinOrderStatus($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderStatus relation
89: * @method OrderQuery rightJoinOrderStatus($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderStatus relation
90: * @method OrderQuery innerJoinOrderStatus($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderStatus relation
91: *
92: * @method OrderQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
93: * @method OrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
94: * @method OrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
95: *
96: * @method OrderQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation
97: * @method OrderQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation
98: * @method OrderQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation
99: *
100: * @method Order findOne(PropelPDO $con = null) Return the first Order matching the query
101: * @method Order findOneOrCreate(PropelPDO $con = null) Return the first Order matching the query, or a new Order object populated from the query conditions when no match is found
102: *
103: * @method Order findOneByRef(string $ref) Return the first Order filtered by the ref column
104: * @method Order findOneByCustomerId(int $customer_id) Return the first Order filtered by the customer_id column
105: * @method Order findOneByAddressInvoice(int $address_invoice) Return the first Order filtered by the address_invoice column
106: * @method Order findOneByAddressDelivery(int $address_delivery) Return the first Order filtered by the address_delivery column
107: * @method Order findOneByInvoiceDate(string $invoice_date) Return the first Order filtered by the invoice_date column
108: * @method Order findOneByCurrencyId(int $currency_id) Return the first Order filtered by the currency_id column
109: * @method Order findOneByCurrencyRate(double $currency_rate) Return the first Order filtered by the currency_rate column
110: * @method Order findOneByTransaction(string $transaction) Return the first Order filtered by the transaction column
111: * @method Order findOneByDeliveryNum(string $delivery_num) Return the first Order filtered by the delivery_num column
112: * @method Order findOneByInvoice(string $invoice) Return the first Order filtered by the invoice column
113: * @method Order findOneByPostage(double $postage) Return the first Order filtered by the postage column
114: * @method Order findOneByPayment(string $payment) Return the first Order filtered by the payment column
115: * @method Order findOneByCarrier(string $carrier) Return the first Order filtered by the carrier column
116: * @method Order findOneByStatusId(int $status_id) Return the first Order filtered by the status_id column
117: * @method Order findOneByLang(string $lang) Return the first Order filtered by the lang column
118: * @method Order findOneByCreatedAt(string $created_at) Return the first Order filtered by the created_at column
119: * @method Order findOneByUpdatedAt(string $updated_at) Return the first Order filtered by the updated_at column
120: *
121: * @method array findById(int $id) Return Order objects filtered by the id column
122: * @method array findByRef(string $ref) Return Order objects filtered by the ref column
123: * @method array findByCustomerId(int $customer_id) Return Order objects filtered by the customer_id column
124: * @method array findByAddressInvoice(int $address_invoice) Return Order objects filtered by the address_invoice column
125: * @method array findByAddressDelivery(int $address_delivery) Return Order objects filtered by the address_delivery column
126: * @method array findByInvoiceDate(string $invoice_date) Return Order objects filtered by the invoice_date column
127: * @method array findByCurrencyId(int $currency_id) Return Order objects filtered by the currency_id column
128: * @method array findByCurrencyRate(double $currency_rate) Return Order objects filtered by the currency_rate column
129: * @method array findByTransaction(string $transaction) Return Order objects filtered by the transaction column
130: * @method array findByDeliveryNum(string $delivery_num) Return Order objects filtered by the delivery_num column
131: * @method array findByInvoice(string $invoice) Return Order objects filtered by the invoice column
132: * @method array findByPostage(double $postage) Return Order objects filtered by the postage column
133: * @method array findByPayment(string $payment) Return Order objects filtered by the payment column
134: * @method array findByCarrier(string $carrier) Return Order objects filtered by the carrier column
135: * @method array findByStatusId(int $status_id) Return Order objects filtered by the status_id column
136: * @method array findByLang(string $lang) Return Order objects filtered by the lang column
137: * @method array findByCreatedAt(string $created_at) Return Order objects filtered by the created_at column
138: * @method array findByUpdatedAt(string $updated_at) Return Order objects filtered by the updated_at column
139: *
140: * @package propel.generator.Thelia.Model.om
141: */
142: abstract class BaseOrderQuery extends ModelCriteria
143: {
144: /**
145: * Initializes internal state of BaseOrderQuery object.
146: *
147: * @param string $dbName The dabase name
148: * @param string $modelName The phpName of a model, e.g. 'Book'
149: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
150: */
151: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Order', $modelAlias = null)
152: {
153: parent::__construct($dbName, $modelName, $modelAlias);
154: }
155:
156: /**
157: * Returns a new OrderQuery object.
158: *
159: * @param string $modelAlias The alias of a model in the query
160: * @param OrderQuery|Criteria $criteria Optional Criteria to build the query from
161: *
162: * @return OrderQuery
163: */
164: public static function create($modelAlias = null, $criteria = null)
165: {
166: if ($criteria instanceof OrderQuery) {
167: return $criteria;
168: }
169: $query = new OrderQuery();
170: if (null !== $modelAlias) {
171: $query->setModelAlias($modelAlias);
172: }
173: if ($criteria instanceof Criteria) {
174: $query->mergeWith($criteria);
175: }
176:
177: return $query;
178: }
179:
180: /**
181: * Find object by primary key.
182: * Propel uses the instance pool to skip the database if the object exists.
183: * Go fast if the query is untouched.
184: *
185: * <code>
186: * $obj = $c->findPk(12, $con);
187: * </code>
188: *
189: * @param mixed $key Primary key to use for the query
190: * @param PropelPDO $con an optional connection object
191: *
192: * @return Order|Order[]|mixed the result, formatted by the current formatter
193: */
194: public function findPk($key, $con = null)
195: {
196: if ($key === null) {
197: return null;
198: }
199: if ((null !== ($obj = OrderPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
200: // the object is alredy in the instance pool
201: return $obj;
202: }
203: if ($con === null) {
204: $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
205: }
206: $this->basePreSelect($con);
207: if ($this->formatter || $this->modelAlias || $this->with || $this->select
208: || $this->selectColumns || $this->asColumns || $this->selectModifiers
209: || $this->map || $this->having || $this->joins) {
210: return $this->findPkComplex($key, $con);
211: } else {
212: return $this->findPkSimple($key, $con);
213: }
214: }
215:
216: /**
217: * Alias of findPk to use instance pooling
218: *
219: * @param mixed $key Primary key to use for the query
220: * @param PropelPDO $con A connection object
221: *
222: * @return Order A model object, or null if the key is not found
223: * @throws PropelException
224: */
225: public function findOneById($key, $con = null)
226: {
227: return $this->findPk($key, $con);
228: }
229:
230: /**
231: * Find object by primary key using raw SQL to go fast.
232: * Bypass doSelect() and the object formatter by using generated code.
233: *
234: * @param mixed $key Primary key to use for the query
235: * @param PropelPDO $con A connection object
236: *
237: * @return Order A model object, or null if the key is not found
238: * @throws PropelException
239: */
240: protected function findPkSimple($key, $con)
241: {
242: $sql = 'SELECT `id`, `ref`, `customer_id`, `address_invoice`, `address_delivery`, `invoice_date`, `currency_id`, `currency_rate`, `transaction`, `delivery_num`, `invoice`, `postage`, `payment`, `carrier`, `status_id`, `lang`, `created_at`, `updated_at` FROM `order` WHERE `id` = :p0';
243: try {
244: $stmt = $con->prepare($sql);
245: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
246: $stmt->execute();
247: } catch (Exception $e) {
248: Propel::log($e->getMessage(), Propel::LOG_ERR);
249: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
250: }
251: $obj = null;
252: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
253: $obj = new Order();
254: $obj->hydrate($row);
255: OrderPeer::addInstanceToPool($obj, (string) $key);
256: }
257: $stmt->closeCursor();
258:
259: return $obj;
260: }
261:
262: /**
263: * Find object by primary key.
264: *
265: * @param mixed $key Primary key to use for the query
266: * @param PropelPDO $con A connection object
267: *
268: * @return Order|Order[]|mixed the result, formatted by the current formatter
269: */
270: protected function findPkComplex($key, $con)
271: {
272: // As the query uses a PK condition, no limit(1) is necessary.
273: $criteria = $this->isKeepQuery() ? clone $this : $this;
274: $stmt = $criteria
275: ->filterByPrimaryKey($key)
276: ->doSelect($con);
277:
278: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
279: }
280:
281: /**
282: * Find objects by primary key
283: * <code>
284: * $objs = $c->findPks(array(12, 56, 832), $con);
285: * </code>
286: * @param array $keys Primary keys to use for the query
287: * @param PropelPDO $con an optional connection object
288: *
289: * @return PropelObjectCollection|Order[]|mixed the list of results, formatted by the current formatter
290: */
291: public function findPks($keys, $con = null)
292: {
293: if ($con === null) {
294: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
295: }
296: $this->basePreSelect($con);
297: $criteria = $this->isKeepQuery() ? clone $this : $this;
298: $stmt = $criteria
299: ->filterByPrimaryKeys($keys)
300: ->doSelect($con);
301:
302: return $criteria->getFormatter()->init($criteria)->format($stmt);
303: }
304:
305: /**
306: * Filter the query by primary key
307: *
308: * @param mixed $key Primary key to use for the query
309: *
310: * @return OrderQuery The current query, for fluid interface
311: */
312: public function filterByPrimaryKey($key)
313: {
314:
315: return $this->addUsingAlias(OrderPeer::ID, $key, Criteria::EQUAL);
316: }
317:
318: /**
319: * Filter the query by a list of primary keys
320: *
321: * @param array $keys The list of primary key to use for the query
322: *
323: * @return OrderQuery The current query, for fluid interface
324: */
325: public function filterByPrimaryKeys($keys)
326: {
327:
328: return $this->addUsingAlias(OrderPeer::ID, $keys, Criteria::IN);
329: }
330:
331: /**
332: * Filter the query on the id column
333: *
334: * Example usage:
335: * <code>
336: * $query->filterById(1234); // WHERE id = 1234
337: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
338: * $query->filterById(array('min' => 12)); // WHERE id >= 12
339: * $query->filterById(array('max' => 12)); // WHERE id <= 12
340: * </code>
341: *
342: * @param mixed $id The value to use as filter.
343: * Use scalar values for equality.
344: * Use array values for in_array() equivalent.
345: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
346: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
347: *
348: * @return OrderQuery The current query, for fluid interface
349: */
350: public function filterById($id = null, $comparison = null)
351: {
352: if (is_array($id)) {
353: $useMinMax = false;
354: if (isset($id['min'])) {
355: $this->addUsingAlias(OrderPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
356: $useMinMax = true;
357: }
358: if (isset($id['max'])) {
359: $this->addUsingAlias(OrderPeer::ID, $id['max'], Criteria::LESS_EQUAL);
360: $useMinMax = true;
361: }
362: if ($useMinMax) {
363: return $this;
364: }
365: if (null === $comparison) {
366: $comparison = Criteria::IN;
367: }
368: }
369:
370: return $this->addUsingAlias(OrderPeer::ID, $id, $comparison);
371: }
372:
373: /**
374: * Filter the query on the ref column
375: *
376: * Example usage:
377: * <code>
378: * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
379: * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
380: * </code>
381: *
382: * @param string $ref The value to use as filter.
383: * Accepts wildcards (* and % trigger a LIKE)
384: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
385: *
386: * @return OrderQuery The current query, for fluid interface
387: */
388: public function filterByRef($ref = null, $comparison = null)
389: {
390: if (null === $comparison) {
391: if (is_array($ref)) {
392: $comparison = Criteria::IN;
393: } elseif (preg_match('/[\%\*]/', $ref)) {
394: $ref = str_replace('*', '%', $ref);
395: $comparison = Criteria::LIKE;
396: }
397: }
398:
399: return $this->addUsingAlias(OrderPeer::REF, $ref, $comparison);
400: }
401:
402: /**
403: * Filter the query on the customer_id column
404: *
405: * Example usage:
406: * <code>
407: * $query->filterByCustomerId(1234); // WHERE customer_id = 1234
408: * $query->filterByCustomerId(array(12, 34)); // WHERE customer_id IN (12, 34)
409: * $query->filterByCustomerId(array('min' => 12)); // WHERE customer_id >= 12
410: * $query->filterByCustomerId(array('max' => 12)); // WHERE customer_id <= 12
411: * </code>
412: *
413: * @see filterByCustomer()
414: *
415: * @param mixed $customerId The value to use as filter.
416: * Use scalar values for equality.
417: * Use array values for in_array() equivalent.
418: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
419: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
420: *
421: * @return OrderQuery The current query, for fluid interface
422: */
423: public function filterByCustomerId($customerId = null, $comparison = null)
424: {
425: if (is_array($customerId)) {
426: $useMinMax = false;
427: if (isset($customerId['min'])) {
428: $this->addUsingAlias(OrderPeer::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
429: $useMinMax = true;
430: }
431: if (isset($customerId['max'])) {
432: $this->addUsingAlias(OrderPeer::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
433: $useMinMax = true;
434: }
435: if ($useMinMax) {
436: return $this;
437: }
438: if (null === $comparison) {
439: $comparison = Criteria::IN;
440: }
441: }
442:
443: return $this->addUsingAlias(OrderPeer::CUSTOMER_ID, $customerId, $comparison);
444: }
445:
446: /**
447: * Filter the query on the address_invoice column
448: *
449: * Example usage:
450: * <code>
451: * $query->filterByAddressInvoice(1234); // WHERE address_invoice = 1234
452: * $query->filterByAddressInvoice(array(12, 34)); // WHERE address_invoice IN (12, 34)
453: * $query->filterByAddressInvoice(array('min' => 12)); // WHERE address_invoice >= 12
454: * $query->filterByAddressInvoice(array('max' => 12)); // WHERE address_invoice <= 12
455: * </code>
456: *
457: * @see filterByOrderAddressRelatedByAddressInvoice()
458: *
459: * @param mixed $addressInvoice The value to use as filter.
460: * Use scalar values for equality.
461: * Use array values for in_array() equivalent.
462: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
463: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
464: *
465: * @return OrderQuery The current query, for fluid interface
466: */
467: public function filterByAddressInvoice($addressInvoice = null, $comparison = null)
468: {
469: if (is_array($addressInvoice)) {
470: $useMinMax = false;
471: if (isset($addressInvoice['min'])) {
472: $this->addUsingAlias(OrderPeer::ADDRESS_INVOICE, $addressInvoice['min'], Criteria::GREATER_EQUAL);
473: $useMinMax = true;
474: }
475: if (isset($addressInvoice['max'])) {
476: $this->addUsingAlias(OrderPeer::ADDRESS_INVOICE, $addressInvoice['max'], Criteria::LESS_EQUAL);
477: $useMinMax = true;
478: }
479: if ($useMinMax) {
480: return $this;
481: }
482: if (null === $comparison) {
483: $comparison = Criteria::IN;
484: }
485: }
486:
487: return $this->addUsingAlias(OrderPeer::ADDRESS_INVOICE, $addressInvoice, $comparison);
488: }
489:
490: /**
491: * Filter the query on the address_delivery column
492: *
493: * Example usage:
494: * <code>
495: * $query->filterByAddressDelivery(1234); // WHERE address_delivery = 1234
496: * $query->filterByAddressDelivery(array(12, 34)); // WHERE address_delivery IN (12, 34)
497: * $query->filterByAddressDelivery(array('min' => 12)); // WHERE address_delivery >= 12
498: * $query->filterByAddressDelivery(array('max' => 12)); // WHERE address_delivery <= 12
499: * </code>
500: *
501: * @see filterByOrderAddressRelatedByAddressDelivery()
502: *
503: * @param mixed $addressDelivery The value to use as filter.
504: * Use scalar values for equality.
505: * Use array values for in_array() equivalent.
506: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
507: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
508: *
509: * @return OrderQuery The current query, for fluid interface
510: */
511: public function filterByAddressDelivery($addressDelivery = null, $comparison = null)
512: {
513: if (is_array($addressDelivery)) {
514: $useMinMax = false;
515: if (isset($addressDelivery['min'])) {
516: $this->addUsingAlias(OrderPeer::ADDRESS_DELIVERY, $addressDelivery['min'], Criteria::GREATER_EQUAL);
517: $useMinMax = true;
518: }
519: if (isset($addressDelivery['max'])) {
520: $this->addUsingAlias(OrderPeer::ADDRESS_DELIVERY, $addressDelivery['max'], Criteria::LESS_EQUAL);
521: $useMinMax = true;
522: }
523: if ($useMinMax) {
524: return $this;
525: }
526: if (null === $comparison) {
527: $comparison = Criteria::IN;
528: }
529: }
530:
531: return $this->addUsingAlias(OrderPeer::ADDRESS_DELIVERY, $addressDelivery, $comparison);
532: }
533:
534: /**
535: * Filter the query on the invoice_date column
536: *
537: * Example usage:
538: * <code>
539: * $query->filterByInvoiceDate('2011-03-14'); // WHERE invoice_date = '2011-03-14'
540: * $query->filterByInvoiceDate('now'); // WHERE invoice_date = '2011-03-14'
541: * $query->filterByInvoiceDate(array('max' => 'yesterday')); // WHERE invoice_date > '2011-03-13'
542: * </code>
543: *
544: * @param mixed $invoiceDate The value to use as filter.
545: * Values can be integers (unix timestamps), DateTime objects, or strings.
546: * Empty strings are treated as NULL.
547: * Use scalar values for equality.
548: * Use array values for in_array() equivalent.
549: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
550: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
551: *
552: * @return OrderQuery The current query, for fluid interface
553: */
554: public function filterByInvoiceDate($invoiceDate = null, $comparison = null)
555: {
556: if (is_array($invoiceDate)) {
557: $useMinMax = false;
558: if (isset($invoiceDate['min'])) {
559: $this->addUsingAlias(OrderPeer::INVOICE_DATE, $invoiceDate['min'], Criteria::GREATER_EQUAL);
560: $useMinMax = true;
561: }
562: if (isset($invoiceDate['max'])) {
563: $this->addUsingAlias(OrderPeer::INVOICE_DATE, $invoiceDate['max'], Criteria::LESS_EQUAL);
564: $useMinMax = true;
565: }
566: if ($useMinMax) {
567: return $this;
568: }
569: if (null === $comparison) {
570: $comparison = Criteria::IN;
571: }
572: }
573:
574: return $this->addUsingAlias(OrderPeer::INVOICE_DATE, $invoiceDate, $comparison);
575: }
576:
577: /**
578: * Filter the query on the currency_id column
579: *
580: * Example usage:
581: * <code>
582: * $query->filterByCurrencyId(1234); // WHERE currency_id = 1234
583: * $query->filterByCurrencyId(array(12, 34)); // WHERE currency_id IN (12, 34)
584: * $query->filterByCurrencyId(array('min' => 12)); // WHERE currency_id >= 12
585: * $query->filterByCurrencyId(array('max' => 12)); // WHERE currency_id <= 12
586: * </code>
587: *
588: * @see filterByCurrency()
589: *
590: * @param mixed $currencyId The value to use as filter.
591: * Use scalar values for equality.
592: * Use array values for in_array() equivalent.
593: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
594: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
595: *
596: * @return OrderQuery The current query, for fluid interface
597: */
598: public function filterByCurrencyId($currencyId = null, $comparison = null)
599: {
600: if (is_array($currencyId)) {
601: $useMinMax = false;
602: if (isset($currencyId['min'])) {
603: $this->addUsingAlias(OrderPeer::CURRENCY_ID, $currencyId['min'], Criteria::GREATER_EQUAL);
604: $useMinMax = true;
605: }
606: if (isset($currencyId['max'])) {
607: $this->addUsingAlias(OrderPeer::CURRENCY_ID, $currencyId['max'], Criteria::LESS_EQUAL);
608: $useMinMax = true;
609: }
610: if ($useMinMax) {
611: return $this;
612: }
613: if (null === $comparison) {
614: $comparison = Criteria::IN;
615: }
616: }
617:
618: return $this->addUsingAlias(OrderPeer::CURRENCY_ID, $currencyId, $comparison);
619: }
620:
621: /**
622: * Filter the query on the currency_rate column
623: *
624: * Example usage:
625: * <code>
626: * $query->filterByCurrencyRate(1234); // WHERE currency_rate = 1234
627: * $query->filterByCurrencyRate(array(12, 34)); // WHERE currency_rate IN (12, 34)
628: * $query->filterByCurrencyRate(array('min' => 12)); // WHERE currency_rate >= 12
629: * $query->filterByCurrencyRate(array('max' => 12)); // WHERE currency_rate <= 12
630: * </code>
631: *
632: * @param mixed $currencyRate The value to use as filter.
633: * Use scalar values for equality.
634: * Use array values for in_array() equivalent.
635: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
636: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
637: *
638: * @return OrderQuery The current query, for fluid interface
639: */
640: public function filterByCurrencyRate($currencyRate = null, $comparison = null)
641: {
642: if (is_array($currencyRate)) {
643: $useMinMax = false;
644: if (isset($currencyRate['min'])) {
645: $this->addUsingAlias(OrderPeer::CURRENCY_RATE, $currencyRate['min'], Criteria::GREATER_EQUAL);
646: $useMinMax = true;
647: }
648: if (isset($currencyRate['max'])) {
649: $this->addUsingAlias(OrderPeer::CURRENCY_RATE, $currencyRate['max'], Criteria::LESS_EQUAL);
650: $useMinMax = true;
651: }
652: if ($useMinMax) {
653: return $this;
654: }
655: if (null === $comparison) {
656: $comparison = Criteria::IN;
657: }
658: }
659:
660: return $this->addUsingAlias(OrderPeer::CURRENCY_RATE, $currencyRate, $comparison);
661: }
662:
663: /**
664: * Filter the query on the transaction column
665: *
666: * Example usage:
667: * <code>
668: * $query->filterByTransaction('fooValue'); // WHERE transaction = 'fooValue'
669: * $query->filterByTransaction('%fooValue%'); // WHERE transaction LIKE '%fooValue%'
670: * </code>
671: *
672: * @param string $transaction The value to use as filter.
673: * Accepts wildcards (* and % trigger a LIKE)
674: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
675: *
676: * @return OrderQuery The current query, for fluid interface
677: */
678: public function filterByTransaction($transaction = null, $comparison = null)
679: {
680: if (null === $comparison) {
681: if (is_array($transaction)) {
682: $comparison = Criteria::IN;
683: } elseif (preg_match('/[\%\*]/', $transaction)) {
684: $transaction = str_replace('*', '%', $transaction);
685: $comparison = Criteria::LIKE;
686: }
687: }
688:
689: return $this->addUsingAlias(OrderPeer::TRANSACTION, $transaction, $comparison);
690: }
691:
692: /**
693: * Filter the query on the delivery_num column
694: *
695: * Example usage:
696: * <code>
697: * $query->filterByDeliveryNum('fooValue'); // WHERE delivery_num = 'fooValue'
698: * $query->filterByDeliveryNum('%fooValue%'); // WHERE delivery_num LIKE '%fooValue%'
699: * </code>
700: *
701: * @param string $deliveryNum The value to use as filter.
702: * Accepts wildcards (* and % trigger a LIKE)
703: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
704: *
705: * @return OrderQuery The current query, for fluid interface
706: */
707: public function filterByDeliveryNum($deliveryNum = null, $comparison = null)
708: {
709: if (null === $comparison) {
710: if (is_array($deliveryNum)) {
711: $comparison = Criteria::IN;
712: } elseif (preg_match('/[\%\*]/', $deliveryNum)) {
713: $deliveryNum = str_replace('*', '%', $deliveryNum);
714: $comparison = Criteria::LIKE;
715: }
716: }
717:
718: return $this->addUsingAlias(OrderPeer::DELIVERY_NUM, $deliveryNum, $comparison);
719: }
720:
721: /**
722: * Filter the query on the invoice column
723: *
724: * Example usage:
725: * <code>
726: * $query->filterByInvoice('fooValue'); // WHERE invoice = 'fooValue'
727: * $query->filterByInvoice('%fooValue%'); // WHERE invoice LIKE '%fooValue%'
728: * </code>
729: *
730: * @param string $invoice The value to use as filter.
731: * Accepts wildcards (* and % trigger a LIKE)
732: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
733: *
734: * @return OrderQuery The current query, for fluid interface
735: */
736: public function filterByInvoice($invoice = null, $comparison = null)
737: {
738: if (null === $comparison) {
739: if (is_array($invoice)) {
740: $comparison = Criteria::IN;
741: } elseif (preg_match('/[\%\*]/', $invoice)) {
742: $invoice = str_replace('*', '%', $invoice);
743: $comparison = Criteria::LIKE;
744: }
745: }
746:
747: return $this->addUsingAlias(OrderPeer::INVOICE, $invoice, $comparison);
748: }
749:
750: /**
751: * Filter the query on the postage column
752: *
753: * Example usage:
754: * <code>
755: * $query->filterByPostage(1234); // WHERE postage = 1234
756: * $query->filterByPostage(array(12, 34)); // WHERE postage IN (12, 34)
757: * $query->filterByPostage(array('min' => 12)); // WHERE postage >= 12
758: * $query->filterByPostage(array('max' => 12)); // WHERE postage <= 12
759: * </code>
760: *
761: * @param mixed $postage The value to use as filter.
762: * Use scalar values for equality.
763: * Use array values for in_array() equivalent.
764: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
765: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
766: *
767: * @return OrderQuery The current query, for fluid interface
768: */
769: public function filterByPostage($postage = null, $comparison = null)
770: {
771: if (is_array($postage)) {
772: $useMinMax = false;
773: if (isset($postage['min'])) {
774: $this->addUsingAlias(OrderPeer::POSTAGE, $postage['min'], Criteria::GREATER_EQUAL);
775: $useMinMax = true;
776: }
777: if (isset($postage['max'])) {
778: $this->addUsingAlias(OrderPeer::POSTAGE, $postage['max'], Criteria::LESS_EQUAL);
779: $useMinMax = true;
780: }
781: if ($useMinMax) {
782: return $this;
783: }
784: if (null === $comparison) {
785: $comparison = Criteria::IN;
786: }
787: }
788:
789: return $this->addUsingAlias(OrderPeer::POSTAGE, $postage, $comparison);
790: }
791:
792: /**
793: * Filter the query on the payment column
794: *
795: * Example usage:
796: * <code>
797: * $query->filterByPayment('fooValue'); // WHERE payment = 'fooValue'
798: * $query->filterByPayment('%fooValue%'); // WHERE payment LIKE '%fooValue%'
799: * </code>
800: *
801: * @param string $payment The value to use as filter.
802: * Accepts wildcards (* and % trigger a LIKE)
803: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
804: *
805: * @return OrderQuery The current query, for fluid interface
806: */
807: public function filterByPayment($payment = null, $comparison = null)
808: {
809: if (null === $comparison) {
810: if (is_array($payment)) {
811: $comparison = Criteria::IN;
812: } elseif (preg_match('/[\%\*]/', $payment)) {
813: $payment = str_replace('*', '%', $payment);
814: $comparison = Criteria::LIKE;
815: }
816: }
817:
818: return $this->addUsingAlias(OrderPeer::PAYMENT, $payment, $comparison);
819: }
820:
821: /**
822: * Filter the query on the carrier column
823: *
824: * Example usage:
825: * <code>
826: * $query->filterByCarrier('fooValue'); // WHERE carrier = 'fooValue'
827: * $query->filterByCarrier('%fooValue%'); // WHERE carrier LIKE '%fooValue%'
828: * </code>
829: *
830: * @param string $carrier The value to use as filter.
831: * Accepts wildcards (* and % trigger a LIKE)
832: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
833: *
834: * @return OrderQuery The current query, for fluid interface
835: */
836: public function filterByCarrier($carrier = null, $comparison = null)
837: {
838: if (null === $comparison) {
839: if (is_array($carrier)) {
840: $comparison = Criteria::IN;
841: } elseif (preg_match('/[\%\*]/', $carrier)) {
842: $carrier = str_replace('*', '%', $carrier);
843: $comparison = Criteria::LIKE;
844: }
845: }
846:
847: return $this->addUsingAlias(OrderPeer::CARRIER, $carrier, $comparison);
848: }
849:
850: /**
851: * Filter the query on the status_id column
852: *
853: * Example usage:
854: * <code>
855: * $query->filterByStatusId(1234); // WHERE status_id = 1234
856: * $query->filterByStatusId(array(12, 34)); // WHERE status_id IN (12, 34)
857: * $query->filterByStatusId(array('min' => 12)); // WHERE status_id >= 12
858: * $query->filterByStatusId(array('max' => 12)); // WHERE status_id <= 12
859: * </code>
860: *
861: * @see filterByOrderStatus()
862: *
863: * @param mixed $statusId The value to use as filter.
864: * Use scalar values for equality.
865: * Use array values for in_array() equivalent.
866: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
867: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
868: *
869: * @return OrderQuery The current query, for fluid interface
870: */
871: public function filterByStatusId($statusId = null, $comparison = null)
872: {
873: if (is_array($statusId)) {
874: $useMinMax = false;
875: if (isset($statusId['min'])) {
876: $this->addUsingAlias(OrderPeer::STATUS_ID, $statusId['min'], Criteria::GREATER_EQUAL);
877: $useMinMax = true;
878: }
879: if (isset($statusId['max'])) {
880: $this->addUsingAlias(OrderPeer::STATUS_ID, $statusId['max'], Criteria::LESS_EQUAL);
881: $useMinMax = true;
882: }
883: if ($useMinMax) {
884: return $this;
885: }
886: if (null === $comparison) {
887: $comparison = Criteria::IN;
888: }
889: }
890:
891: return $this->addUsingAlias(OrderPeer::STATUS_ID, $statusId, $comparison);
892: }
893:
894: /**
895: * Filter the query on the lang column
896: *
897: * Example usage:
898: * <code>
899: * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
900: * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
901: * </code>
902: *
903: * @param string $lang The value to use as filter.
904: * Accepts wildcards (* and % trigger a LIKE)
905: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
906: *
907: * @return OrderQuery The current query, for fluid interface
908: */
909: public function filterByLang($lang = null, $comparison = null)
910: {
911: if (null === $comparison) {
912: if (is_array($lang)) {
913: $comparison = Criteria::IN;
914: } elseif (preg_match('/[\%\*]/', $lang)) {
915: $lang = str_replace('*', '%', $lang);
916: $comparison = Criteria::LIKE;
917: }
918: }
919:
920: return $this->addUsingAlias(OrderPeer::LANG, $lang, $comparison);
921: }
922:
923: /**
924: * Filter the query on the created_at column
925: *
926: * Example usage:
927: * <code>
928: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
929: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
930: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
931: * </code>
932: *
933: * @param mixed $createdAt The value to use as filter.
934: * Values can be integers (unix timestamps), DateTime objects, or strings.
935: * Empty strings are treated as NULL.
936: * Use scalar values for equality.
937: * Use array values for in_array() equivalent.
938: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
939: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
940: *
941: * @return OrderQuery The current query, for fluid interface
942: */
943: public function filterByCreatedAt($createdAt = null, $comparison = null)
944: {
945: if (is_array($createdAt)) {
946: $useMinMax = false;
947: if (isset($createdAt['min'])) {
948: $this->addUsingAlias(OrderPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
949: $useMinMax = true;
950: }
951: if (isset($createdAt['max'])) {
952: $this->addUsingAlias(OrderPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
953: $useMinMax = true;
954: }
955: if ($useMinMax) {
956: return $this;
957: }
958: if (null === $comparison) {
959: $comparison = Criteria::IN;
960: }
961: }
962:
963: return $this->addUsingAlias(OrderPeer::CREATED_AT, $createdAt, $comparison);
964: }
965:
966: /**
967: * Filter the query on the updated_at column
968: *
969: * Example usage:
970: * <code>
971: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
972: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
973: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
974: * </code>
975: *
976: * @param mixed $updatedAt The value to use as filter.
977: * Values can be integers (unix timestamps), DateTime objects, or strings.
978: * Empty strings are treated as NULL.
979: * Use scalar values for equality.
980: * Use array values for in_array() equivalent.
981: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
982: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
983: *
984: * @return OrderQuery The current query, for fluid interface
985: */
986: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
987: {
988: if (is_array($updatedAt)) {
989: $useMinMax = false;
990: if (isset($updatedAt['min'])) {
991: $this->addUsingAlias(OrderPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
992: $useMinMax = true;
993: }
994: if (isset($updatedAt['max'])) {
995: $this->addUsingAlias(OrderPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
996: $useMinMax = true;
997: }
998: if ($useMinMax) {
999: return $this;
1000: }
1001: if (null === $comparison) {
1002: $comparison = Criteria::IN;
1003: }
1004: }
1005:
1006: return $this->addUsingAlias(OrderPeer::UPDATED_AT, $updatedAt, $comparison);
1007: }
1008:
1009: /**
1010: * Filter the query by a related Currency object
1011: *
1012: * @param Currency|PropelObjectCollection $currency The related object(s) to use as filter
1013: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1014: *
1015: * @return OrderQuery The current query, for fluid interface
1016: * @throws PropelException - if the provided filter is invalid.
1017: */
1018: public function filterByCurrency($currency, $comparison = null)
1019: {
1020: if ($currency instanceof Currency) {
1021: return $this
1022: ->addUsingAlias(OrderPeer::CURRENCY_ID, $currency->getId(), $comparison);
1023: } elseif ($currency instanceof PropelObjectCollection) {
1024: if (null === $comparison) {
1025: $comparison = Criteria::IN;
1026: }
1027:
1028: return $this
1029: ->addUsingAlias(OrderPeer::CURRENCY_ID, $currency->toKeyValue('PrimaryKey', 'Id'), $comparison);
1030: } else {
1031: throw new PropelException('filterByCurrency() only accepts arguments of type Currency or PropelCollection');
1032: }
1033: }
1034:
1035: /**
1036: * Adds a JOIN clause to the query using the Currency relation
1037: *
1038: * @param string $relationAlias optional alias for the relation
1039: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1040: *
1041: * @return OrderQuery The current query, for fluid interface
1042: */
1043: public function joinCurrency($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1044: {
1045: $tableMap = $this->getTableMap();
1046: $relationMap = $tableMap->getRelation('Currency');
1047:
1048: // create a ModelJoin object for this join
1049: $join = new ModelJoin();
1050: $join->setJoinType($joinType);
1051: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1052: if ($previousJoin = $this->getPreviousJoin()) {
1053: $join->setPreviousJoin($previousJoin);
1054: }
1055:
1056: // add the ModelJoin to the current object
1057: if ($relationAlias) {
1058: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1059: $this->addJoinObject($join, $relationAlias);
1060: } else {
1061: $this->addJoinObject($join, 'Currency');
1062: }
1063:
1064: return $this;
1065: }
1066:
1067: /**
1068: * Use the Currency relation Currency object
1069: *
1070: * @see useQuery()
1071: *
1072: * @param string $relationAlias optional alias for the relation,
1073: * to be used as main alias in the secondary query
1074: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1075: *
1076: * @return \Thelia\Model\CurrencyQuery A secondary query class using the current class as primary query
1077: */
1078: public function useCurrencyQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1079: {
1080: return $this
1081: ->joinCurrency($relationAlias, $joinType)
1082: ->useQuery($relationAlias ? $relationAlias : 'Currency', '\Thelia\Model\CurrencyQuery');
1083: }
1084:
1085: /**
1086: * Filter the query by a related Customer object
1087: *
1088: * @param Customer|PropelObjectCollection $customer The related object(s) to use as filter
1089: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1090: *
1091: * @return OrderQuery The current query, for fluid interface
1092: * @throws PropelException - if the provided filter is invalid.
1093: */
1094: public function filterByCustomer($customer, $comparison = null)
1095: {
1096: if ($customer instanceof Customer) {
1097: return $this
1098: ->addUsingAlias(OrderPeer::CUSTOMER_ID, $customer->getId(), $comparison);
1099: } elseif ($customer instanceof PropelObjectCollection) {
1100: if (null === $comparison) {
1101: $comparison = Criteria::IN;
1102: }
1103:
1104: return $this
1105: ->addUsingAlias(OrderPeer::CUSTOMER_ID, $customer->toKeyValue('PrimaryKey', 'Id'), $comparison);
1106: } else {
1107: throw new PropelException('filterByCustomer() only accepts arguments of type Customer or PropelCollection');
1108: }
1109: }
1110:
1111: /**
1112: * Adds a JOIN clause to the query using the Customer relation
1113: *
1114: * @param string $relationAlias optional alias for the relation
1115: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1116: *
1117: * @return OrderQuery The current query, for fluid interface
1118: */
1119: public function joinCustomer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1120: {
1121: $tableMap = $this->getTableMap();
1122: $relationMap = $tableMap->getRelation('Customer');
1123:
1124: // create a ModelJoin object for this join
1125: $join = new ModelJoin();
1126: $join->setJoinType($joinType);
1127: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1128: if ($previousJoin = $this->getPreviousJoin()) {
1129: $join->setPreviousJoin($previousJoin);
1130: }
1131:
1132: // add the ModelJoin to the current object
1133: if ($relationAlias) {
1134: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1135: $this->addJoinObject($join, $relationAlias);
1136: } else {
1137: $this->addJoinObject($join, 'Customer');
1138: }
1139:
1140: return $this;
1141: }
1142:
1143: /**
1144: * Use the Customer relation Customer object
1145: *
1146: * @see useQuery()
1147: *
1148: * @param string $relationAlias optional alias for the relation,
1149: * to be used as main alias in the secondary query
1150: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1151: *
1152: * @return \Thelia\Model\CustomerQuery A secondary query class using the current class as primary query
1153: */
1154: public function useCustomerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1155: {
1156: return $this
1157: ->joinCustomer($relationAlias, $joinType)
1158: ->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
1159: }
1160:
1161: /**
1162: * Filter the query by a related OrderAddress object
1163: *
1164: * @param OrderAddress|PropelObjectCollection $orderAddress The related object(s) to use as filter
1165: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1166: *
1167: * @return OrderQuery The current query, for fluid interface
1168: * @throws PropelException - if the provided filter is invalid.
1169: */
1170: public function filterByOrderAddressRelatedByAddressInvoice($orderAddress, $comparison = null)
1171: {
1172: if ($orderAddress instanceof OrderAddress) {
1173: return $this
1174: ->addUsingAlias(OrderPeer::ADDRESS_INVOICE, $orderAddress->getId(), $comparison);
1175: } elseif ($orderAddress instanceof PropelObjectCollection) {
1176: if (null === $comparison) {
1177: $comparison = Criteria::IN;
1178: }
1179:
1180: return $this
1181: ->addUsingAlias(OrderPeer::ADDRESS_INVOICE, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
1182: } else {
1183: throw new PropelException('filterByOrderAddressRelatedByAddressInvoice() only accepts arguments of type OrderAddress or PropelCollection');
1184: }
1185: }
1186:
1187: /**
1188: * Adds a JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation
1189: *
1190: * @param string $relationAlias optional alias for the relation
1191: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1192: *
1193: * @return OrderQuery The current query, for fluid interface
1194: */
1195: public function joinOrderAddressRelatedByAddressInvoice($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1196: {
1197: $tableMap = $this->getTableMap();
1198: $relationMap = $tableMap->getRelation('OrderAddressRelatedByAddressInvoice');
1199:
1200: // create a ModelJoin object for this join
1201: $join = new ModelJoin();
1202: $join->setJoinType($joinType);
1203: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1204: if ($previousJoin = $this->getPreviousJoin()) {
1205: $join->setPreviousJoin($previousJoin);
1206: }
1207:
1208: // add the ModelJoin to the current object
1209: if ($relationAlias) {
1210: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1211: $this->addJoinObject($join, $relationAlias);
1212: } else {
1213: $this->addJoinObject($join, 'OrderAddressRelatedByAddressInvoice');
1214: }
1215:
1216: return $this;
1217: }
1218:
1219: /**
1220: * Use the OrderAddressRelatedByAddressInvoice relation OrderAddress object
1221: *
1222: * @see useQuery()
1223: *
1224: * @param string $relationAlias optional alias for the relation,
1225: * to be used as main alias in the secondary query
1226: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1227: *
1228: * @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
1229: */
1230: public function useOrderAddressRelatedByAddressInvoiceQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1231: {
1232: return $this
1233: ->joinOrderAddressRelatedByAddressInvoice($relationAlias, $joinType)
1234: ->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByAddressInvoice', '\Thelia\Model\OrderAddressQuery');
1235: }
1236:
1237: /**
1238: * Filter the query by a related OrderAddress object
1239: *
1240: * @param OrderAddress|PropelObjectCollection $orderAddress The related object(s) to use as filter
1241: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1242: *
1243: * @return OrderQuery The current query, for fluid interface
1244: * @throws PropelException - if the provided filter is invalid.
1245: */
1246: public function filterByOrderAddressRelatedByAddressDelivery($orderAddress, $comparison = null)
1247: {
1248: if ($orderAddress instanceof OrderAddress) {
1249: return $this
1250: ->addUsingAlias(OrderPeer::ADDRESS_DELIVERY, $orderAddress->getId(), $comparison);
1251: } elseif ($orderAddress instanceof PropelObjectCollection) {
1252: if (null === $comparison) {
1253: $comparison = Criteria::IN;
1254: }
1255:
1256: return $this
1257: ->addUsingAlias(OrderPeer::ADDRESS_DELIVERY, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
1258: } else {
1259: throw new PropelException('filterByOrderAddressRelatedByAddressDelivery() only accepts arguments of type OrderAddress or PropelCollection');
1260: }
1261: }
1262:
1263: /**
1264: * Adds a JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation
1265: *
1266: * @param string $relationAlias optional alias for the relation
1267: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1268: *
1269: * @return OrderQuery The current query, for fluid interface
1270: */
1271: public function joinOrderAddressRelatedByAddressDelivery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1272: {
1273: $tableMap = $this->getTableMap();
1274: $relationMap = $tableMap->getRelation('OrderAddressRelatedByAddressDelivery');
1275:
1276: // create a ModelJoin object for this join
1277: $join = new ModelJoin();
1278: $join->setJoinType($joinType);
1279: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1280: if ($previousJoin = $this->getPreviousJoin()) {
1281: $join->setPreviousJoin($previousJoin);
1282: }
1283:
1284: // add the ModelJoin to the current object
1285: if ($relationAlias) {
1286: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1287: $this->addJoinObject($join, $relationAlias);
1288: } else {
1289: $this->addJoinObject($join, 'OrderAddressRelatedByAddressDelivery');
1290: }
1291:
1292: return $this;
1293: }
1294:
1295: /**
1296: * Use the OrderAddressRelatedByAddressDelivery relation OrderAddress object
1297: *
1298: * @see useQuery()
1299: *
1300: * @param string $relationAlias optional alias for the relation,
1301: * to be used as main alias in the secondary query
1302: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1303: *
1304: * @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
1305: */
1306: public function useOrderAddressRelatedByAddressDeliveryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1307: {
1308: return $this
1309: ->joinOrderAddressRelatedByAddressDelivery($relationAlias, $joinType)
1310: ->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByAddressDelivery', '\Thelia\Model\OrderAddressQuery');
1311: }
1312:
1313: /**
1314: * Filter the query by a related OrderStatus object
1315: *
1316: * @param OrderStatus|PropelObjectCollection $orderStatus The related object(s) to use as filter
1317: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1318: *
1319: * @return OrderQuery The current query, for fluid interface
1320: * @throws PropelException - if the provided filter is invalid.
1321: */
1322: public function filterByOrderStatus($orderStatus, $comparison = null)
1323: {
1324: if ($orderStatus instanceof OrderStatus) {
1325: return $this
1326: ->addUsingAlias(OrderPeer::STATUS_ID, $orderStatus->getId(), $comparison);
1327: } elseif ($orderStatus instanceof PropelObjectCollection) {
1328: if (null === $comparison) {
1329: $comparison = Criteria::IN;
1330: }
1331:
1332: return $this
1333: ->addUsingAlias(OrderPeer::STATUS_ID, $orderStatus->toKeyValue('PrimaryKey', 'Id'), $comparison);
1334: } else {
1335: throw new PropelException('filterByOrderStatus() only accepts arguments of type OrderStatus or PropelCollection');
1336: }
1337: }
1338:
1339: /**
1340: * Adds a JOIN clause to the query using the OrderStatus relation
1341: *
1342: * @param string $relationAlias optional alias for the relation
1343: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1344: *
1345: * @return OrderQuery The current query, for fluid interface
1346: */
1347: public function joinOrderStatus($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1348: {
1349: $tableMap = $this->getTableMap();
1350: $relationMap = $tableMap->getRelation('OrderStatus');
1351:
1352: // create a ModelJoin object for this join
1353: $join = new ModelJoin();
1354: $join->setJoinType($joinType);
1355: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1356: if ($previousJoin = $this->getPreviousJoin()) {
1357: $join->setPreviousJoin($previousJoin);
1358: }
1359:
1360: // add the ModelJoin to the current object
1361: if ($relationAlias) {
1362: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1363: $this->addJoinObject($join, $relationAlias);
1364: } else {
1365: $this->addJoinObject($join, 'OrderStatus');
1366: }
1367:
1368: return $this;
1369: }
1370:
1371: /**
1372: * Use the OrderStatus relation OrderStatus object
1373: *
1374: * @see useQuery()
1375: *
1376: * @param string $relationAlias optional alias for the relation,
1377: * to be used as main alias in the secondary query
1378: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1379: *
1380: * @return \Thelia\Model\OrderStatusQuery A secondary query class using the current class as primary query
1381: */
1382: public function useOrderStatusQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1383: {
1384: return $this
1385: ->joinOrderStatus($relationAlias, $joinType)
1386: ->useQuery($relationAlias ? $relationAlias : 'OrderStatus', '\Thelia\Model\OrderStatusQuery');
1387: }
1388:
1389: /**
1390: * Filter the query by a related OrderProduct object
1391: *
1392: * @param OrderProduct|PropelObjectCollection $orderProduct the related object to use as filter
1393: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1394: *
1395: * @return OrderQuery The current query, for fluid interface
1396: * @throws PropelException - if the provided filter is invalid.
1397: */
1398: public function filterByOrderProduct($orderProduct, $comparison = null)
1399: {
1400: if ($orderProduct instanceof OrderProduct) {
1401: return $this
1402: ->addUsingAlias(OrderPeer::ID, $orderProduct->getOrderId(), $comparison);
1403: } elseif ($orderProduct instanceof PropelObjectCollection) {
1404: return $this
1405: ->useOrderProductQuery()
1406: ->filterByPrimaryKeys($orderProduct->getPrimaryKeys())
1407: ->endUse();
1408: } else {
1409: throw new PropelException('filterByOrderProduct() only accepts arguments of type OrderProduct or PropelCollection');
1410: }
1411: }
1412:
1413: /**
1414: * Adds a JOIN clause to the query using the OrderProduct relation
1415: *
1416: * @param string $relationAlias optional alias for the relation
1417: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1418: *
1419: * @return OrderQuery The current query, for fluid interface
1420: */
1421: public function joinOrderProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1422: {
1423: $tableMap = $this->getTableMap();
1424: $relationMap = $tableMap->getRelation('OrderProduct');
1425:
1426: // create a ModelJoin object for this join
1427: $join = new ModelJoin();
1428: $join->setJoinType($joinType);
1429: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1430: if ($previousJoin = $this->getPreviousJoin()) {
1431: $join->setPreviousJoin($previousJoin);
1432: }
1433:
1434: // add the ModelJoin to the current object
1435: if ($relationAlias) {
1436: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1437: $this->addJoinObject($join, $relationAlias);
1438: } else {
1439: $this->addJoinObject($join, 'OrderProduct');
1440: }
1441:
1442: return $this;
1443: }
1444:
1445: /**
1446: * Use the OrderProduct relation OrderProduct object
1447: *
1448: * @see useQuery()
1449: *
1450: * @param string $relationAlias optional alias for the relation,
1451: * to be used as main alias in the secondary query
1452: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1453: *
1454: * @return \Thelia\Model\OrderProductQuery A secondary query class using the current class as primary query
1455: */
1456: public function useOrderProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1457: {
1458: return $this
1459: ->joinOrderProduct($relationAlias, $joinType)
1460: ->useQuery($relationAlias ? $relationAlias : 'OrderProduct', '\Thelia\Model\OrderProductQuery');
1461: }
1462:
1463: /**
1464: * Filter the query by a related CouponOrder object
1465: *
1466: * @param CouponOrder|PropelObjectCollection $couponOrder the related object to use as filter
1467: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
1468: *
1469: * @return OrderQuery The current query, for fluid interface
1470: * @throws PropelException - if the provided filter is invalid.
1471: */
1472: public function filterByCouponOrder($couponOrder, $comparison = null)
1473: {
1474: if ($couponOrder instanceof CouponOrder) {
1475: return $this
1476: ->addUsingAlias(OrderPeer::ID, $couponOrder->getOrderId(), $comparison);
1477: } elseif ($couponOrder instanceof PropelObjectCollection) {
1478: return $this
1479: ->useCouponOrderQuery()
1480: ->filterByPrimaryKeys($couponOrder->getPrimaryKeys())
1481: ->endUse();
1482: } else {
1483: throw new PropelException('filterByCouponOrder() only accepts arguments of type CouponOrder or PropelCollection');
1484: }
1485: }
1486:
1487: /**
1488: * Adds a JOIN clause to the query using the CouponOrder relation
1489: *
1490: * @param string $relationAlias optional alias for the relation
1491: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1492: *
1493: * @return OrderQuery The current query, for fluid interface
1494: */
1495: public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1496: {
1497: $tableMap = $this->getTableMap();
1498: $relationMap = $tableMap->getRelation('CouponOrder');
1499:
1500: // create a ModelJoin object for this join
1501: $join = new ModelJoin();
1502: $join->setJoinType($joinType);
1503: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1504: if ($previousJoin = $this->getPreviousJoin()) {
1505: $join->setPreviousJoin($previousJoin);
1506: }
1507:
1508: // add the ModelJoin to the current object
1509: if ($relationAlias) {
1510: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1511: $this->addJoinObject($join, $relationAlias);
1512: } else {
1513: $this->addJoinObject($join, 'CouponOrder');
1514: }
1515:
1516: return $this;
1517: }
1518:
1519: /**
1520: * Use the CouponOrder relation CouponOrder object
1521: *
1522: * @see useQuery()
1523: *
1524: * @param string $relationAlias optional alias for the relation,
1525: * to be used as main alias in the secondary query
1526: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1527: *
1528: * @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query
1529: */
1530: public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
1531: {
1532: return $this
1533: ->joinCouponOrder($relationAlias, $joinType)
1534: ->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery');
1535: }
1536:
1537: /**
1538: * Exclude object from result
1539: *
1540: * @param Order $order Object to remove from the list of results
1541: *
1542: * @return OrderQuery The current query, for fluid interface
1543: */
1544: public function prune($order = null)
1545: {
1546: if ($order) {
1547: $this->addUsingAlias(OrderPeer::ID, $order->getId(), Criteria::NOT_EQUAL);
1548: }
1549:
1550: return $this;
1551: }
1552:
1553: // timestampable behavior
1554:
1555: /**
1556: * Filter by the latest updated
1557: *
1558: * @param int $nbDays Maximum age of the latest update in days
1559: *
1560: * @return OrderQuery The current query, for fluid interface
1561: */
1562: public function recentlyUpdated($nbDays = 7)
1563: {
1564: return $this->addUsingAlias(OrderPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1565: }
1566:
1567: /**
1568: * Order by update date desc
1569: *
1570: * @return OrderQuery The current query, for fluid interface
1571: */
1572: public function lastUpdatedFirst()
1573: {
1574: return $this->addDescendingOrderByColumn(OrderPeer::UPDATED_AT);
1575: }
1576:
1577: /**
1578: * Order by update date asc
1579: *
1580: * @return OrderQuery The current query, for fluid interface
1581: */
1582: public function firstUpdatedFirst()
1583: {
1584: return $this->addAscendingOrderByColumn(OrderPeer::UPDATED_AT);
1585: }
1586:
1587: /**
1588: * Filter by the latest created
1589: *
1590: * @param int $nbDays Maximum age of in days
1591: *
1592: * @return OrderQuery The current query, for fluid interface
1593: */
1594: public function recentlyCreated($nbDays = 7)
1595: {
1596: return $this->addUsingAlias(OrderPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1597: }
1598:
1599: /**
1600: * Order by create date desc
1601: *
1602: * @return OrderQuery The current query, for fluid interface
1603: */
1604: public function lastCreatedFirst()
1605: {
1606: return $this->addDescendingOrderByColumn(OrderPeer::CREATED_AT);
1607: }
1608:
1609: /**
1610: * Order by create date asc
1611: *
1612: * @return OrderQuery The current query, for fluid interface
1613: */
1614: public function firstCreatedFirst()
1615: {
1616: return $this->addAscendingOrderByColumn(OrderPeer::CREATED_AT);
1617: }
1618: }
1619: