# File core/lib/Thelia/Model/om/BaseOrderQuery.php | thelia

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