# File core/lib/Thelia/Model/om/BaseCouponOrderQuery.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\CouponOrderPeer;
     17: use Thelia\Model\CouponOrderQuery;
     18: use Thelia\Model\Order;
     19:
     20: /**
     21:  * Base class that represents a query for the 'coupon_order' table.
     22:  *
     23:  *
     24:  *
     25:  * @method CouponOrderQuery orderById($order = Criteria::ASC) Order by the id column
     26:  * @method CouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
     27:  * @method CouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column
     28:  * @method CouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column
     29:  * @method CouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     30:  * @method CouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     31:  *
     32:  * @method CouponOrderQuery groupById() Group by the id column
     33:  * @method CouponOrderQuery groupByOrderId() Group by the order_id column
     34:  * @method CouponOrderQuery groupByCode() Group by the code column
     35:  * @method CouponOrderQuery groupByValue() Group by the value column
     36:  * @method CouponOrderQuery groupByCreatedAt() Group by the created_at column
     37:  * @method CouponOrderQuery groupByUpdatedAt() Group by the updated_at column
     38:  *
     39:  * @method CouponOrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     40:  * @method CouponOrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     41:  * @method CouponOrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     42:  *
     43:  * @method CouponOrderQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
     44:  * @method CouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
     45:  * @method CouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
     46:  *
     47:  * @method CouponOrder findOne(PropelPDO $con = null) Return the first CouponOrder matching the query
     48:  * @method CouponOrder findOneOrCreate(PropelPDO $con = null) Return the first CouponOrder matching the query, or a new CouponOrder object populated from the query conditions when no match is found
     49:  *
     50:  * @method CouponOrder findOneById(int $id) Return the first CouponOrder filtered by the id column
     51:  * @method CouponOrder findOneByOrderId(int $order_id) Return the first CouponOrder filtered by the order_id column
     52:  * @method CouponOrder findOneByCode(string $code) Return the first CouponOrder filtered by the code column
     53:  * @method CouponOrder findOneByValue(double $value) Return the first CouponOrder filtered by the value column
     54:  * @method CouponOrder findOneByCreatedAt(string $created_at) Return the first CouponOrder filtered by the created_at column
     55:  * @method CouponOrder findOneByUpdatedAt(string $updated_at) Return the first CouponOrder filtered by the updated_at column
     56:  *
     57:  * @method array findById(int $id) Return CouponOrder objects filtered by the id column
     58:  * @method array findByOrderId(int $order_id) Return CouponOrder objects filtered by the order_id column
     59:  * @method array findByCode(string $code) Return CouponOrder objects filtered by the code column
     60:  * @method array findByValue(double $value) Return CouponOrder objects filtered by the value column
     61:  * @method array findByCreatedAt(string $created_at) Return CouponOrder objects filtered by the created_at column
     62:  * @method array findByUpdatedAt(string $updated_at) Return CouponOrder objects filtered by the updated_at column
     63:  *
     64:  * @package    propel.generator.Thelia.Model.om
     65:  */
     66: abstract class BaseCouponOrderQuery extends ModelCriteria
     67: {
     68:     /**
     69:      * Initializes internal state of BaseCouponOrderQuery object.
     70:      *
     71:      * @param     string $dbName The dabase name
     72:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     73:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     74:      */
     75:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CouponOrder', $modelAlias = null)
     76:     {
     77:         parent::__construct($dbName, $modelName, $modelAlias);
     78:     }
     79:
     80:     /**
     81:      * Returns a new CouponOrderQuery object.
     82:      *
     83:      * @param     string $modelAlias The alias of a model in the query
     84:      * @param     CouponOrderQuery|Criteria $criteria Optional Criteria to build the query from
     85:      *
     86:      * @return CouponOrderQuery
     87:      */
     88:     public static function create($modelAlias = null, $criteria = null)
     89:     {
     90:         if ($criteria instanceof CouponOrderQuery) {
     91:             return $criteria;
     92:         }
     93:         $query = new CouponOrderQuery();
     94:         if (null !== $modelAlias) {
     95:             $query->setModelAlias($modelAlias);
     96:         }
     97:         if ($criteria instanceof Criteria) {
     98:             $query->mergeWith($criteria);
     99:         }
    100:
    101:         return $query;
    102:     }
    103:
    104:     /**
    105:      * Find object by primary key.
    106:      * Propel uses the instance pool to skip the database if the object exists.
    107:      * Go fast if the query is untouched.
    108:      *
    109:      * <code>
    110:      * $obj  = $c->findPk(12, $con);
    111:      * </code>
    112:      *
    113:      * @param mixed $key Primary key to use for the query
    114:      * @param     PropelPDO $con an optional connection object
    115:      *
    116:      * @return   CouponOrder|CouponOrder[]|mixed the result, formatted by the current formatter
    117:      */
    118:     public function findPk($key, $con = null)
    119:     {
    120:         if ($key === null) {
    121:             return null;
    122:         }
    123:         if ((null !== ($obj = CouponOrderPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
    124:             // the object is alredy in the instance pool
    125:             return $obj;
    126:         }
    127:         if ($con === null) {
    128:             $con = Propel::getConnection(CouponOrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    129:         }
    130:         $this->basePreSelect($con);
    131:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
    132:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
    133:          || $this->map || $this->having || $this->joins) {
    134:             return $this->findPkComplex($key, $con);
    135:         } else {
    136:             return $this->findPkSimple($key, $con);
    137:         }
    138:     }
    139:
    140:     /**
    141:      * Find object by primary key using raw SQL to go fast.
    142:      * Bypass doSelect() and the object formatter by using generated code.
    143:      *
    144:      * @param     mixed $key Primary key to use for the query
    145:      * @param     PropelPDO $con A connection object
    146:      *
    147:      * @return   CouponOrder A model object, or null if the key is not found
    148:      * @throws   PropelException
    149:      */
    150:     protected function findPkSimple($key, $con)
    151:     {
    152:         $sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `VALUE`, `CREATED_AT`, `UPDATED_AT` FROM `coupon_order` WHERE `ID` = :p0';
    153:         try {
    154:             $stmt = $con->prepare($sql);
    155:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
    156:             $stmt->execute();
    157:         } catch (Exception $e) {
    158:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    159:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    160:         }
    161:         $obj = null;
    162:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    163:             $obj = new CouponOrder();
    164:             $obj->hydrate($row);
    165:             CouponOrderPeer::addInstanceToPool($obj, (string) $key);
    166:         }
    167:         $stmt->closeCursor();
    168:
    169:         return $obj;
    170:     }
    171:
    172:     /**
    173:      * Find object by primary key.
    174:      *
    175:      * @param     mixed $key Primary key to use for the query
    176:      * @param     PropelPDO $con A connection object
    177:      *
    178:      * @return CouponOrder|CouponOrder[]|mixed the result, formatted by the current formatter
    179:      */
    180:     protected function findPkComplex($key, $con)
    181:     {
    182:         // As the query uses a PK condition, no limit(1) is necessary.
    183:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    184:         $stmt = $criteria
    185:             ->filterByPrimaryKey($key)
    186:             ->doSelect($con);
    187:
    188:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    189:     }
    190:
    191:     /**
    192:      * Find objects by primary key
    193:      * <code>
    194:      * $objs = $c->findPks(array(12, 56, 832), $con);
    195:      * </code>
    196:      * @param     array $keys Primary keys to use for the query
    197:      * @param     PropelPDO $con an optional connection object
    198:      *
    199:      * @return PropelObjectCollection|CouponOrder[]|mixed the list of results, formatted by the current formatter
    200:      */
    201:     public function findPks($keys, $con = null)
    202:     {
    203:         if ($con === null) {
    204:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    205:         }
    206:         $this->basePreSelect($con);
    207:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    208:         $stmt = $criteria
    209:             ->filterByPrimaryKeys($keys)
    210:             ->doSelect($con);
    211:
    212:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    213:     }
    214:
    215:     /**
    216:      * Filter the query by primary key
    217:      *
    218:      * @param     mixed $key Primary key to use for the query
    219:      *
    220:      * @return CouponOrderQuery The current query, for fluid interface
    221:      */
    222:     public function filterByPrimaryKey($key)
    223:     {
    224:
    225:         return $this->addUsingAlias(CouponOrderPeer::ID, $key, Criteria::EQUAL);
    226:     }
    227:
    228:     /**
    229:      * Filter the query by a list of primary keys
    230:      *
    231:      * @param     array $keys The list of primary key to use for the query
    232:      *
    233:      * @return CouponOrderQuery The current query, for fluid interface
    234:      */
    235:     public function filterByPrimaryKeys($keys)
    236:     {
    237:
    238:         return $this->addUsingAlias(CouponOrderPeer::ID, $keys, Criteria::IN);
    239:     }
    240:
    241:     /**
    242:      * Filter the query on the id column
    243:      *
    244:      * Example usage:
    245:      * <code>
    246:      * $query->filterById(1234); // WHERE id = 1234
    247:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    248:      * $query->filterById(array('min' => 12)); // WHERE id > 12
    249:      * </code>
    250:      *
    251:      * @param     mixed $id The value to use as filter.
    252:      *              Use scalar values for equality.
    253:      *              Use array values for in_array() equivalent.
    254:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    255:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    256:      *
    257:      * @return CouponOrderQuery The current query, for fluid interface
    258:      */
    259:     public function filterById($id = null, $comparison = null)
    260:     {
    261:         if (is_array($id) && null === $comparison) {
    262:             $comparison = Criteria::IN;
    263:         }
    264:
    265:         return $this->addUsingAlias(CouponOrderPeer::ID, $id, $comparison);
    266:     }
    267:
    268:     /**
    269:      * Filter the query on the order_id column
    270:      *
    271:      * Example usage:
    272:      * <code>
    273:      * $query->filterByOrderId(1234); // WHERE order_id = 1234
    274:      * $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
    275:      * $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
    276:      * </code>
    277:      *
    278:      * @see       filterByOrder()
    279:      *
    280:      * @param     mixed $orderId The value to use as filter.
    281:      *              Use scalar values for equality.
    282:      *              Use array values for in_array() equivalent.
    283:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    284:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    285:      *
    286:      * @return CouponOrderQuery The current query, for fluid interface
    287:      */
    288:     public function filterByOrderId($orderId = null, $comparison = null)
    289:     {
    290:         if (is_array($orderId)) {
    291:             $useMinMax = false;
    292:             if (isset($orderId['min'])) {
    293:                 $this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
    294:                 $useMinMax = true;
    295:             }
    296:             if (isset($orderId['max'])) {
    297:                 $this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
    298:                 $useMinMax = true;
    299:             }
    300:             if ($useMinMax) {
    301:                 return $this;
    302:             }
    303:             if (null === $comparison) {
    304:                 $comparison = Criteria::IN;
    305:             }
    306:         }
    307:
    308:         return $this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId, $comparison);
    309:     }
    310:
    311:     /**
    312:      * Filter the query on the code column
    313:      *
    314:      * Example usage:
    315:      * <code>
    316:      * $query->filterByCode('fooValue');   // WHERE code = 'fooValue'
    317:      * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
    318:      * </code>
    319:      *
    320:      * @param     string $code The value to use as filter.
    321:      *              Accepts wildcards (* and % trigger a LIKE)
    322:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    323:      *
    324:      * @return CouponOrderQuery The current query, for fluid interface
    325:      */
    326:     public function filterByCode($code = null, $comparison = null)
    327:     {
    328:         if (null === $comparison) {
    329:             if (is_array($code)) {
    330:                 $comparison = Criteria::IN;
    331:             } elseif (preg_match('/[\%\*]/', $code)) {
    332:                 $code = str_replace('*', '%', $code);
    333:                 $comparison = Criteria::LIKE;
    334:             }
    335:         }
    336:
    337:         return $this->addUsingAlias(CouponOrderPeer::CODE, $code, $comparison);
    338:     }
    339:
    340:     /**
    341:      * Filter the query on the value column
    342:      *
    343:      * Example usage:
    344:      * <code>
    345:      * $query->filterByValue(1234); // WHERE value = 1234
    346:      * $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34)
    347:      * $query->filterByValue(array('min' => 12)); // WHERE value > 12
    348:      * </code>
    349:      *
    350:      * @param     mixed $value The value to use as filter.
    351:      *              Use scalar values for equality.
    352:      *              Use array values for in_array() equivalent.
    353:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    354:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    355:      *
    356:      * @return CouponOrderQuery The current query, for fluid interface
    357:      */
    358:     public function filterByValue($value = null, $comparison = null)
    359:     {
    360:         if (is_array($value)) {
    361:             $useMinMax = false;
    362:             if (isset($value['min'])) {
    363:                 $this->addUsingAlias(CouponOrderPeer::VALUE, $value['min'], Criteria::GREATER_EQUAL);
    364:                 $useMinMax = true;
    365:             }
    366:             if (isset($value['max'])) {
    367:                 $this->addUsingAlias(CouponOrderPeer::VALUE, $value['max'], Criteria::LESS_EQUAL);
    368:                 $useMinMax = true;
    369:             }
    370:             if ($useMinMax) {
    371:                 return $this;
    372:             }
    373:             if (null === $comparison) {
    374:                 $comparison = Criteria::IN;
    375:             }
    376:         }
    377:
    378:         return $this->addUsingAlias(CouponOrderPeer::VALUE, $value, $comparison);
    379:     }
    380:
    381:     /**
    382:      * Filter the query on the created_at column
    383:      *
    384:      * Example usage:
    385:      * <code>
    386:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    387:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    388:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    389:      * </code>
    390:      *
    391:      * @param     mixed $createdAt The value to use as filter.
    392:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    393:      *              Empty strings are treated as NULL.
    394:      *              Use scalar values for equality.
    395:      *              Use array values for in_array() equivalent.
    396:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    397:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    398:      *
    399:      * @return CouponOrderQuery The current query, for fluid interface
    400:      */
    401:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    402:     {
    403:         if (is_array($createdAt)) {
    404:             $useMinMax = false;
    405:             if (isset($createdAt['min'])) {
    406:                 $this->addUsingAlias(CouponOrderPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    407:                 $useMinMax = true;
    408:             }
    409:             if (isset($createdAt['max'])) {
    410:                 $this->addUsingAlias(CouponOrderPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    411:                 $useMinMax = true;
    412:             }
    413:             if ($useMinMax) {
    414:                 return $this;
    415:             }
    416:             if (null === $comparison) {
    417:                 $comparison = Criteria::IN;
    418:             }
    419:         }
    420:
    421:         return $this->addUsingAlias(CouponOrderPeer::CREATED_AT, $createdAt, $comparison);
    422:     }
    423:
    424:     /**
    425:      * Filter the query on the updated_at column
    426:      *
    427:      * Example usage:
    428:      * <code>
    429:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    430:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    431:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    432:      * </code>
    433:      *
    434:      * @param     mixed $updatedAt The value to use as filter.
    435:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    436:      *              Empty strings are treated as NULL.
    437:      *              Use scalar values for equality.
    438:      *              Use array values for in_array() equivalent.
    439:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    440:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    441:      *
    442:      * @return CouponOrderQuery The current query, for fluid interface
    443:      */
    444:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    445:     {
    446:         if (is_array($updatedAt)) {
    447:             $useMinMax = false;
    448:             if (isset($updatedAt['min'])) {
    449:                 $this->addUsingAlias(CouponOrderPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    450:                 $useMinMax = true;
    451:             }
    452:             if (isset($updatedAt['max'])) {
    453:                 $this->addUsingAlias(CouponOrderPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    454:                 $useMinMax = true;
    455:             }
    456:             if ($useMinMax) {
    457:                 return $this;
    458:             }
    459:             if (null === $comparison) {
    460:                 $comparison = Criteria::IN;
    461:             }
    462:         }
    463:
    464:         return $this->addUsingAlias(CouponOrderPeer::UPDATED_AT, $updatedAt, $comparison);
    465:     }
    466:
    467:     /**
    468:      * Filter the query by a related Order object
    469:      *
    470:      * @param   Order|PropelObjectCollection $order The related object(s) to use as filter
    471:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    472:      *
    473:      * @return   CouponOrderQuery The current query, for fluid interface
    474:      * @throws   PropelException - if the provided filter is invalid.
    475:      */
    476:     public function filterByOrder($order, $comparison = null)
    477:     {
    478:         if ($order instanceof Order) {
    479:             return $this
    480:                 ->addUsingAlias(CouponOrderPeer::ORDER_ID, $order->getId(), $comparison);
    481:         } elseif ($order instanceof PropelObjectCollection) {
    482:             if (null === $comparison) {
    483:                 $comparison = Criteria::IN;
    484:             }
    485:
    486:             return $this
    487:                 ->addUsingAlias(CouponOrderPeer::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
    488:         } else {
    489:             throw new PropelException('filterByOrder() only accepts arguments of type Order or PropelCollection');
    490:         }
    491:     }
    492:
    493:     /**
    494:      * Adds a JOIN clause to the query using the Order relation
    495:      *
    496:      * @param     string $relationAlias optional alias for the relation
    497:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    498:      *
    499:      * @return CouponOrderQuery The current query, for fluid interface
    500:      */
    501:     public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    502:     {
    503:         $tableMap = $this->getTableMap();
    504:         $relationMap = $tableMap->getRelation('Order');
    505:
    506:         // create a ModelJoin object for this join
    507:         $join = new ModelJoin();
    508:         $join->setJoinType($joinType);
    509:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    510:         if ($previousJoin = $this->getPreviousJoin()) {
    511:             $join->setPreviousJoin($previousJoin);
    512:         }
    513:
    514:         // add the ModelJoin to the current object
    515:         if ($relationAlias) {
    516:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    517:             $this->addJoinObject($join, $relationAlias);
    518:         } else {
    519:             $this->addJoinObject($join, 'Order');
    520:         }
    521:
    522:         return $this;
    523:     }
    524:
    525:     /**
    526:      * Use the Order relation Order object
    527:      *
    528:      * @see       useQuery()
    529:      *
    530:      * @param     string $relationAlias optional alias for the relation,
    531:      *                                   to be used as main alias in the secondary query
    532:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    533:      *
    534:      * @return   \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
    535:      */
    536:     public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    537:     {
    538:         return $this
    539:             ->joinOrder($relationAlias, $joinType)
    540:             ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
    541:     }
    542:
    543:     /**
    544:      * Exclude object from result
    545:      *
    546:      * @param   CouponOrder $couponOrder Object to remove from the list of results
    547:      *
    548:      * @return CouponOrderQuery The current query, for fluid interface
    549:      */
    550:     public function prune($couponOrder = null)
    551:     {
    552:         if ($couponOrder) {
    553:             $this->addUsingAlias(CouponOrderPeer::ID, $couponOrder->getId(), Criteria::NOT_EQUAL);
    554:         }
    555:
    556:         return $this;
    557:     }
    558:
    559:     // timestampable behavior
    560:
    561:     /**
    562:      * Filter by the latest updated
    563:      *
    564:      * @param      int $nbDays Maximum age of the latest update in days
    565:      *
    566:      * @return     CouponOrderQuery The current query, for fluid interface
    567:      */
    568:     public function recentlyUpdated($nbDays = 7)
    569:     {
    570:         return $this->addUsingAlias(CouponOrderPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    571:     }
    572:
    573:     /**
    574:      * Order by update date desc
    575:      *
    576:      * @return     CouponOrderQuery The current query, for fluid interface
    577:      */
    578:     public function lastUpdatedFirst()
    579:     {
    580:         return $this->addDescendingOrderByColumn(CouponOrderPeer::UPDATED_AT);
    581:     }
    582:
    583:     /**
    584:      * Order by update date asc
    585:      *
    586:      * @return     CouponOrderQuery The current query, for fluid interface
    587:      */
    588:     public function firstUpdatedFirst()
    589:     {
    590:         return $this->addAscendingOrderByColumn(CouponOrderPeer::UPDATED_AT);
    591:     }
    592:
    593:     /**
    594:      * Filter by the latest created
    595:      *
    596:      * @param      int $nbDays Maximum age of in days
    597:      *
    598:      * @return     CouponOrderQuery The current query, for fluid interface
    599:      */
    600:     public function recentlyCreated($nbDays = 7)
    601:     {
    602:         return $this->addUsingAlias(CouponOrderPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    603:     }
    604:
    605:     /**
    606:      * Order by create date desc
    607:      *
    608:      * @return     CouponOrderQuery The current query, for fluid interface
    609:      */
    610:     public function lastCreatedFirst()
    611:     {
    612:         return $this->addDescendingOrderByColumn(CouponOrderPeer::CREATED_AT);
    613:     }
    614:
    615:     /**
    616:      * Order by create date asc
    617:      *
    618:      * @return     CouponOrderQuery The current query, for fluid interface
    619:      */
    620:     public function firstCreatedFirst()
    621:     {
    622:         return $this->addAscendingOrderByColumn(CouponOrderPeer::CREATED_AT);
    623:     }
    624: }
    625: