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