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