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