      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\Feature;
     16: use Thelia\Model\FeatureAv;
     17: use Thelia\Model\FeatureProd;
     18: use Thelia\Model\FeatureProdPeer;
     19: use Thelia\Model\FeatureProdQuery;
     20: use Thelia\Model\Product;
     21:
     22: /**
     23:  * Base class that represents a query for the 'feature_prod' table.
     24:  *
     25:  *
     26:  *
     27:  * @method FeatureProdQuery orderById($order = Criteria::ASC) Order by the id column
     28:  * @method FeatureProdQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
     29:  * @method FeatureProdQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
     30:  * @method FeatureProdQuery orderByFeatureAvId($order = Criteria::ASC) Order by the feature_av_id column
     31:  * @method FeatureProdQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column
     32:  * @method FeatureProdQuery orderByPosition($order = Criteria::ASC) Order by the position column
     33:  * @method FeatureProdQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     34:  * @method FeatureProdQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     35:  *
     36:  * @method FeatureProdQuery groupById() Group by the id column
     37:  * @method FeatureProdQuery groupByProductId() Group by the product_id column
     38:  * @method FeatureProdQuery groupByFeatureId() Group by the feature_id column
     39:  * @method FeatureProdQuery groupByFeatureAvId() Group by the feature_av_id column
     40:  * @method FeatureProdQuery groupByByDefault() Group by the by_default column
     41:  * @method FeatureProdQuery groupByPosition() Group by the position column
     42:  * @method FeatureProdQuery groupByCreatedAt() Group by the created_at column
     43:  * @method FeatureProdQuery groupByUpdatedAt() Group by the updated_at column
     44:  *
     45:  * @method FeatureProdQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     46:  * @method FeatureProdQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     47:  * @method FeatureProdQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     48:  *
     49:  * @method FeatureProdQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
     50:  * @method FeatureProdQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
     51:  * @method FeatureProdQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
     52:  *
     53:  * @method FeatureProdQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation
     54:  * @method FeatureProdQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
     55:  * @method FeatureProdQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
     56:  *
     57:  * @method FeatureProdQuery leftJoinFeatureAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureAv relation
     58:  * @method FeatureProdQuery rightJoinFeatureAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureAv relation
     59:  * @method FeatureProdQuery innerJoinFeatureAv($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureAv relation
     60:  *
     61:  * @method FeatureProd findOne(PropelPDO $con = null) Return the first FeatureProd matching the query
     62:  * @method FeatureProd findOneOrCreate(PropelPDO $con = null) Return the first FeatureProd matching the query, or a new FeatureProd object populated from the query conditions when no match is found
     63:  *
     64:  * @method FeatureProd findOneByProductId(int $product_id) Return the first FeatureProd filtered by the product_id column
     65:  * @method FeatureProd findOneByFeatureId(int $feature_id) Return the first FeatureProd filtered by the feature_id column
     66:  * @method FeatureProd findOneByFeatureAvId(int $feature_av_id) Return the first FeatureProd filtered by the feature_av_id column
     67:  * @method FeatureProd findOneByByDefault(string $by_default) Return the first FeatureProd filtered by the by_default column
     68:  * @method FeatureProd findOneByPosition(int $position) Return the first FeatureProd filtered by the position column
     69:  * @method FeatureProd findOneByCreatedAt(string $created_at) Return the first FeatureProd filtered by the created_at column
     70:  * @method FeatureProd findOneByUpdatedAt(string $updated_at) Return the first FeatureProd filtered by the updated_at column
     71:  *
     72:  * @method array findById(int $id) Return FeatureProd objects filtered by the id column
     73:  * @method array findByProductId(int $product_id) Return FeatureProd objects filtered by the product_id column
     74:  * @method array findByFeatureId(int $feature_id) Return FeatureProd objects filtered by the feature_id column
     75:  * @method array findByFeatureAvId(int $feature_av_id) Return FeatureProd objects filtered by the feature_av_id column
     76:  * @method array findByByDefault(string $by_default) Return FeatureProd objects filtered by the by_default column
     77:  * @method array findByPosition(int $position) Return FeatureProd objects filtered by the position column
     78:  * @method array findByCreatedAt(string $created_at) Return FeatureProd objects filtered by the created_at column
     79:  * @method array findByUpdatedAt(string $updated_at) Return FeatureProd objects filtered by the updated_at column
     80:  *
     81:  * @package    propel.generator.Thelia.Model.om
     82:  */
     83: abstract class BaseFeatureProdQuery extends ModelCriteria
     84: {
     85:     /**
     86:      * Initializes internal state of BaseFeatureProdQuery object.
     87:      *
     88:      * @param     string $dbName The dabase name
     89:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     90:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     91:      */
     92:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\FeatureProd', $modelAlias = null)
     93:     {
     94:         parent::__construct($dbName, $modelName, $modelAlias);
     95:     }
     96:
     97:     /**
     98:      * Returns a new FeatureProdQuery object.
     99:      *
    100:      * @param     string $modelAlias The alias of a model in the query
    101:      * @param   FeatureProdQuery|Criteria $criteria Optional Criteria to build the query from
    102:      *
    103:      * @return FeatureProdQuery
    104:      */
    105:     public static function create($modelAlias = null, $criteria = null)
    106:     {
    107:         if ($criteria instanceof FeatureProdQuery) {
    108:             return $criteria;
    109:         }
    110:         $query = new FeatureProdQuery();
    111:         if (null !== $modelAlias) {
    112:             $query->setModelAlias($modelAlias);
    113:         }
    114:         if ($criteria instanceof Criteria) {
    115:             $query->mergeWith($criteria);
    116:         }
    117:
    118:         return $query;
    119:     }
    120:
    121:     /**
    122:      * Find object by primary key.
    123:      * Propel uses the instance pool to skip the database if the object exists.
    124:      * Go fast if the query is untouched.
    125:      *
    126:      * <code>
    127:      * $obj  = $c->findPk(12, $con);
    128:      * </code>
    129:      *
    130:      * @param mixed $key Primary key to use for the query
    131:      * @param     PropelPDO $con an optional connection object
    132:      *
    133:      * @return   FeatureProd|FeatureProd[]|mixed the result, formatted by the current formatter
    134:      */
    135:     public function findPk($key, $con = null)
    136:     {
    137:         if ($key === null) {
    138:             return null;
    139:         }
    140:         if ((null !== ($obj = FeatureProdPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
    141:             // the object is alredy in the instance pool
    142:             return $obj;
    143:         }
    144:         if ($con === null) {
    145:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    146:         }
    147:         $this->basePreSelect($con);
    148:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
    149:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
    150:          || $this->map || $this->having || $this->joins) {
    151:             return $this->findPkComplex($key, $con);
    152:         } else {
    153:             return $this->findPkSimple($key, $con);
    154:         }
    155:     }
    156:
    157:     /**
    158:      * Alias of findPk to use instance pooling
    159:      *
    160:      * @param     mixed $key Primary key to use for the query
    161:      * @param     PropelPDO $con A connection object
    162:      *
    163:      * @return                 FeatureProd A model object, or null if the key is not found
    164:      * @throws PropelException
    165:      */
    166:      public function findOneById($key, $con = null)
    167:      {
    168:         return $this->findPk($key, $con);
    169:      }
    170:
    171:     /**
    172:      * Find object by primary key using raw SQL to go fast.
    173:      * Bypass doSelect() and the object formatter by using generated code.
    174:      *
    175:      * @param     mixed $key Primary key to use for the query
    176:      * @param     PropelPDO $con A connection object
    177:      *
    178:      * @return                 FeatureProd A model object, or null if the key is not found
    179:      * @throws PropelException
    180:      */
    181:     protected function findPkSimple($key, $con)
    182:     {
    183:         $sql = 'SELECT `id`, `product_id`, `feature_id`, `feature_av_id`, `by_default`, `position`, `created_at`, `updated_at` FROM `feature_prod` WHERE `id` = :p0';
    184:         try {
    185:             $stmt = $con->prepare($sql);
    186:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
    187:             $stmt->execute();
    188:         } catch (Exception $e) {
    189:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    190:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    191:         }
    192:         $obj = null;
    193:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    194:             $obj = new FeatureProd();
    195:             $obj->hydrate($row);
    196:             FeatureProdPeer::addInstanceToPool($obj, (string) $key);
    197:         }
    198:         $stmt->closeCursor();
    199:
    200:         return $obj;
    201:     }
    202:
    203:     /**
    204:      * Find object by primary key.
    205:      *
    206:      * @param     mixed $key Primary key to use for the query
    207:      * @param     PropelPDO $con A connection object
    208:      *
    209:      * @return FeatureProd|FeatureProd[]|mixed the result, formatted by the current formatter
    210:      */
    211:     protected function findPkComplex($key, $con)
    212:     {
    213:         // As the query uses a PK condition, no limit(1) is necessary.
    214:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    215:         $stmt = $criteria
    216:             ->filterByPrimaryKey($key)
    217:             ->doSelect($con);
    218:
    219:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    220:     }
    221:
    222:     /**
    223:      * Find objects by primary key
    224:      * <code>
    225:      * $objs = $c->findPks(array(12, 56, 832), $con);
    226:      * </code>
    227:      * @param     array $keys Primary keys to use for the query
    228:      * @param     PropelPDO $con an optional connection object
    229:      *
    230:      * @return PropelObjectCollection|FeatureProd[]|mixed the list of results, formatted by the current formatter
    231:      */
    232:     public function findPks($keys, $con = null)
    233:     {
    234:         if ($con === null) {
    235:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    236:         }
    237:         $this->basePreSelect($con);
    238:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    239:         $stmt = $criteria
    240:             ->filterByPrimaryKeys($keys)
    241:             ->doSelect($con);
    242:
    243:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    244:     }
    245:
    246:     /**
    247:      * Filter the query by primary key
    248:      *
    249:      * @param     mixed $key Primary key to use for the query
    250:      *
    251:      * @return FeatureProdQuery The current query, for fluid interface
    252:      */
    253:     public function filterByPrimaryKey($key)
    254:     {
    255:
    256:         return $this->addUsingAlias(FeatureProdPeer::ID, $key, Criteria::EQUAL);
    257:     }
    258:
    259:     /**
    260:      * Filter the query by a list of primary keys
    261:      *
    262:      * @param     array $keys The list of primary key to use for the query
    263:      *
    264:      * @return FeatureProdQuery The current query, for fluid interface
    265:      */
    266:     public function filterByPrimaryKeys($keys)
    267:     {
    268:
    269:         return $this->addUsingAlias(FeatureProdPeer::ID, $keys, Criteria::IN);
    270:     }
    271:
    272:     /**
    273:      * Filter the query on the id column
    274:      *
    275:      * Example usage:
    276:      * <code>
    277:      * $query->filterById(1234); // WHERE id = 1234
    278:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    279:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
    280:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
    281:      * </code>
    282:      *
    283:      * @param     mixed $id The value to use as filter.
    284:      *              Use scalar values for equality.
    285:      *              Use array values for in_array() equivalent.
    286:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    287:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    288:      *
    289:      * @return FeatureProdQuery The current query, for fluid interface
    290:      */
    291:     public function filterById($id = null, $comparison = null)
    292:     {
    293:         if (is_array($id)) {
    294:             $useMinMax = false;
    295:             if (isset($id['min'])) {
    296:                 $this->addUsingAlias(FeatureProdPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
    297:                 $useMinMax = true;
    298:             }
    299:             if (isset($id['max'])) {
    300:                 $this->addUsingAlias(FeatureProdPeer::ID, $id['max'], Criteria::LESS_EQUAL);
    301:                 $useMinMax = true;
    302:             }
    303:             if ($useMinMax) {
    304:                 return $this;
    305:             }
    306:             if (null === $comparison) {
    307:                 $comparison = Criteria::IN;
    308:             }
    309:         }
    310:
    311:         return $this->addUsingAlias(FeatureProdPeer::ID, $id, $comparison);
    312:     }
    313:
    314:     /**
    315:      * Filter the query on the product_id column
    316:      *
    317:      * Example usage:
    318:      * <code>
    319:      * $query->filterByProductId(1234); // WHERE product_id = 1234
    320:      * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
    321:      * $query->filterByProductId(array('min' => 12)); // WHERE product_id >= 12
    322:      * $query->filterByProductId(array('max' => 12)); // WHERE product_id <= 12
    323:      * </code>
    324:      *
    325:      * @see       filterByProduct()
    326:      *
    327:      * @param     mixed $productId The value to use as filter.
    328:      *              Use scalar values for equality.
    329:      *              Use array values for in_array() equivalent.
    330:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    331:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    332:      *
    333:      * @return FeatureProdQuery The current query, for fluid interface
    334:      */
    335:     public function filterByProductId($productId = null, $comparison = null)
    336:     {
    337:         if (is_array($productId)) {
    338:             $useMinMax = false;
    339:             if (isset($productId['min'])) {
    340:                 $this->addUsingAlias(FeatureProdPeer::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
    341:                 $useMinMax = true;
    342:             }
    343:             if (isset($productId['max'])) {
    344:                 $this->addUsingAlias(FeatureProdPeer::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
    345:                 $useMinMax = true;
    346:             }
    347:             if ($useMinMax) {
    348:                 return $this;
    349:             }
    350:             if (null === $comparison) {
    351:                 $comparison = Criteria::IN;
    352:             }
    353:         }
    354:
    355:         return $this->addUsingAlias(FeatureProdPeer::PRODUCT_ID, $productId, $comparison);
    356:     }
    357:
    358:     /**
    359:      * Filter the query on the feature_id column
    360:      *
    361:      * Example usage:
    362:      * <code>
    363:      * $query->filterByFeatureId(1234); // WHERE feature_id = 1234
    364:      * $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34)
    365:      * $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id >= 12
    366:      * $query->filterByFeatureId(array('max' => 12)); // WHERE feature_id <= 12
    367:      * </code>
    368:      *
    369:      * @see       filterByFeature()
    370:      *
    371:      * @param     mixed $featureId The value to use as filter.
    372:      *              Use scalar values for equality.
    373:      *              Use array values for in_array() equivalent.
    374:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    375:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    376:      *
    377:      * @return FeatureProdQuery The current query, for fluid interface
    378:      */
    379:     public function filterByFeatureId($featureId = null, $comparison = null)
    380:     {
    381:         if (is_array($featureId)) {
    382:             $useMinMax = false;
    383:             if (isset($featureId['min'])) {
    384:                 $this->addUsingAlias(FeatureProdPeer::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL);
    385:                 $useMinMax = true;
    386:             }
    387:             if (isset($featureId['max'])) {
    388:                 $this->addUsingAlias(FeatureProdPeer::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL);
    389:                 $useMinMax = true;
    390:             }
    391:             if ($useMinMax) {
    392:                 return $this;
    393:             }
    394:             if (null === $comparison) {
    395:                 $comparison = Criteria::IN;
    396:             }
    397:         }
    398:
    399:         return $this->addUsingAlias(FeatureProdPeer::FEATURE_ID, $featureId, $comparison);
    400:     }
    401:
    402:     /**
    403:      * Filter the query on the feature_av_id column
    404:      *
    405:      * Example usage:
    406:      * <code>
    407:      * $query->filterByFeatureAvId(1234); // WHERE feature_av_id = 1234
    408:      * $query->filterByFeatureAvId(array(12, 34)); // WHERE feature_av_id IN (12, 34)
    409:      * $query->filterByFeatureAvId(array('min' => 12)); // WHERE feature_av_id >= 12
    410:      * $query->filterByFeatureAvId(array('max' => 12)); // WHERE feature_av_id <= 12
    411:      * </code>
    412:      *
    413:      * @see       filterByFeatureAv()
    414:      *
    415:      * @param     mixed $featureAvId The value to use as filter.
    416:      *              Use scalar values for equality.
    417:      *              Use array values for in_array() equivalent.
    418:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    419:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    420:      *
    421:      * @return FeatureProdQuery The current query, for fluid interface
    422:      */
    423:     public function filterByFeatureAvId($featureAvId = null, $comparison = null)
    424:     {
    425:         if (is_array($featureAvId)) {
    426:             $useMinMax = false;
    427:             if (isset($featureAvId['min'])) {
    428:                 $this->addUsingAlias(FeatureProdPeer::FEATURE_AV_ID, $featureAvId['min'], Criteria::GREATER_EQUAL);
    429:                 $useMinMax = true;
    430:             }
    431:             if (isset($featureAvId['max'])) {
    432:                 $this->addUsingAlias(FeatureProdPeer::FEATURE_AV_ID, $featureAvId['max'], Criteria::LESS_EQUAL);
    433:                 $useMinMax = true;
    434:             }
    435:             if ($useMinMax) {
    436:                 return $this;
    437:             }
    438:             if (null === $comparison) {
    439:                 $comparison = Criteria::IN;
    440:             }
    441:         }
    442:
    443:         return $this->addUsingAlias(FeatureProdPeer::FEATURE_AV_ID, $featureAvId, $comparison);
    444:     }
    445:
    446:     /**
    447:      * Filter the query on the by_default column
    448:      *
    449:      * Example usage:
    450:      * <code>
    451:      * $query->filterByByDefault('fooValue');   // WHERE by_default = 'fooValue'
    452:      * $query->filterByByDefault('%fooValue%'); // WHERE by_default LIKE '%fooValue%'
    453:      * </code>
    454:      *
    455:      * @param     string $byDefault The value to use as filter.
    456:      *              Accepts wildcards (* and % trigger a LIKE)
    457:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    458:      *
    459:      * @return FeatureProdQuery The current query, for fluid interface
    460:      */
    461:     public function filterByByDefault($byDefault = null, $comparison = null)
    462:     {
    463:         if (null === $comparison) {
    464:             if (is_array($byDefault)) {
    465:                 $comparison = Criteria::IN;
    466:             } elseif (preg_match('/[\%\*]/', $byDefault)) {
    467:                 $byDefault = str_replace('*', '%', $byDefault);
    468:                 $comparison = Criteria::LIKE;
    469:             }
    470:         }
    471:
    472:         return $this->addUsingAlias(FeatureProdPeer::BY_DEFAULT, $byDefault, $comparison);
    473:     }
    474:
    475:     /**
    476:      * Filter the query on the position column
    477:      *
    478:      * Example usage:
    479:      * <code>
    480:      * $query->filterByPosition(1234); // WHERE position = 1234
    481:      * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
    482:      * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
    483:      * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
    484:      * </code>
    485:      *
    486:      * @param     mixed $position The value to use as filter.
    487:      *              Use scalar values for equality.
    488:      *              Use array values for in_array() equivalent.
    489:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    490:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    491:      *
    492:      * @return FeatureProdQuery The current query, for fluid interface
    493:      */
    494:     public function filterByPosition($position = null, $comparison = null)
    495:     {
    496:         if (is_array($position)) {
    497:             $useMinMax = false;
    498:             if (isset($position['min'])) {
    499:                 $this->addUsingAlias(FeatureProdPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
    500:                 $useMinMax = true;
    501:             }
    502:             if (isset($position['max'])) {
    503:                 $this->addUsingAlias(FeatureProdPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
    504:                 $useMinMax = true;
    505:             }
    506:             if ($useMinMax) {
    507:                 return $this;
    508:             }
    509:             if (null === $comparison) {
    510:                 $comparison = Criteria::IN;
    511:             }
    512:         }
    513:
    514:         return $this->addUsingAlias(FeatureProdPeer::POSITION, $position, $comparison);
    515:     }
    516:
    517:     /**
    518:      * Filter the query on the created_at column
    519:      *
    520:      * Example usage:
    521:      * <code>
    522:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    523:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    524:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    525:      * </code>
    526:      *
    527:      * @param     mixed $createdAt The value to use as filter.
    528:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    529:      *              Empty strings are treated as NULL.
    530:      *              Use scalar values for equality.
    531:      *              Use array values for in_array() equivalent.
    532:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    533:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    534:      *
    535:      * @return FeatureProdQuery The current query, for fluid interface
    536:      */
    537:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    538:     {
    539:         if (is_array($createdAt)) {
    540:             $useMinMax = false;
    541:             if (isset($createdAt['min'])) {
    542:                 $this->addUsingAlias(FeatureProdPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    543:                 $useMinMax = true;
    544:             }
    545:             if (isset($createdAt['max'])) {
    546:                 $this->addUsingAlias(FeatureProdPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    547:                 $useMinMax = true;
    548:             }
    549:             if ($useMinMax) {
    550:                 return $this;
    551:             }
    552:             if (null === $comparison) {
    553:                 $comparison = Criteria::IN;
    554:             }
    555:         }
    556:
    557:         return $this->addUsingAlias(FeatureProdPeer::CREATED_AT, $createdAt, $comparison);
    558:     }
    559:
    560:     /**
    561:      * Filter the query on the updated_at column
    562:      *
    563:      * Example usage:
    564:      * <code>
    565:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    566:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    567:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    568:      * </code>
    569:      *
    570:      * @param     mixed $updatedAt The value to use as filter.
    571:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    572:      *              Empty strings are treated as NULL.
    573:      *              Use scalar values for equality.
    574:      *              Use array values for in_array() equivalent.
    575:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    576:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    577:      *
    578:      * @return FeatureProdQuery The current query, for fluid interface
    579:      */
    580:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    581:     {
    582:         if (is_array($updatedAt)) {
    583:             $useMinMax = false;
    584:             if (isset($updatedAt['min'])) {
    585:                 $this->addUsingAlias(FeatureProdPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    586:                 $useMinMax = true;
    587:             }
    588:             if (isset($updatedAt['max'])) {
    589:                 $this->addUsingAlias(FeatureProdPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    590:                 $useMinMax = true;
    591:             }
    592:             if ($useMinMax) {
    593:                 return $this;
    594:             }
    595:             if (null === $comparison) {
    596:                 $comparison = Criteria::IN;
    597:             }
    598:         }
    599:
    600:         return $this->addUsingAlias(FeatureProdPeer::UPDATED_AT, $updatedAt, $comparison);
    601:     }
    602:
    603:     /**
    604:      * Filter the query by a related Product object
    605:      *
    606:      * @param   Product|PropelObjectCollection $product The related object(s) to use as filter
    607:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    608:      *
    609:      * @return                 FeatureProdQuery The current query, for fluid interface
    610:      * @throws PropelException - if the provided filter is invalid.
    611:      */
    612:     public function filterByProduct($product, $comparison = null)
    613:     {
    614:         if ($product instanceof Product) {
    615:             return $this
    616:                 ->addUsingAlias(FeatureProdPeer::PRODUCT_ID, $product->getId(), $comparison);
    617:         } elseif ($product instanceof PropelObjectCollection) {
    618:             if (null === $comparison) {
    619:                 $comparison = Criteria::IN;
    620:             }
    621:
    622:             return $this
    623:                 ->addUsingAlias(FeatureProdPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
    624:         } else {
    625:             throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
    626:         }
    627:     }
    628:
    629:     /**
    630:      * Adds a JOIN clause to the query using the Product relation
    631:      *
    632:      * @param     string $relationAlias optional alias for the relation
    633:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    634:      *
    635:      * @return FeatureProdQuery The current query, for fluid interface
    636:      */
    637:     public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    638:     {
    639:         $tableMap = $this->getTableMap();
    640:         $relationMap = $tableMap->getRelation('Product');
    641:
    642:         // create a ModelJoin object for this join
    643:         $join = new ModelJoin();
    644:         $join->setJoinType($joinType);
    645:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    646:         if ($previousJoin = $this->getPreviousJoin()) {
    647:             $join->setPreviousJoin($previousJoin);
    648:         }
    649:
    650:         // add the ModelJoin to the current object
    651:         if ($relationAlias) {
    652:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    653:             $this->addJoinObject($join, $relationAlias);
    654:         } else {
    655:             $this->addJoinObject($join, 'Product');
    656:         }
    657:
    658:         return $this;
    659:     }
    660:
    661:     /**
    662:      * Use the Product relation Product object
    663:      *
    664:      * @see       useQuery()
    665:      *
    666:      * @param     string $relationAlias optional alias for the relation,
    667:      *                                   to be used as main alias in the secondary query
    668:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    669:      *
    670:      * @return   \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
    671:      */
    672:     public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    673:     {
    674:         return $this
    675:             ->joinProduct($relationAlias, $joinType)
    676:             ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
    677:     }
    678:
    679:     /**
    680:      * Filter the query by a related Feature object
    681:      *
    682:      * @param   Feature|PropelObjectCollection $feature The related object(s) to use as filter
    683:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    684:      *
    685:      * @return                 FeatureProdQuery The current query, for fluid interface
    686:      * @throws PropelException - if the provided filter is invalid.
    687:      */
    688:     public function filterByFeature($feature, $comparison = null)
    689:     {
    690:         if ($feature instanceof Feature) {
    691:             return $this
    692:                 ->addUsingAlias(FeatureProdPeer::FEATURE_ID, $feature->getId(), $comparison);
    693:         } elseif ($feature instanceof PropelObjectCollection) {
    694:             if (null === $comparison) {
    695:                 $comparison = Criteria::IN;
    696:             }
    697:
    698:             return $this
    699:                 ->addUsingAlias(FeatureProdPeer::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
    700:         } else {
    701:             throw new PropelException('filterByFeature() only accepts arguments of type Feature or PropelCollection');
    702:         }
    703:     }
    704:
    705:     /**
    706:      * Adds a JOIN clause to the query using the Feature relation
    707:      *
    708:      * @param     string $relationAlias optional alias for the relation
    709:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    710:      *
    711:      * @return FeatureProdQuery The current query, for fluid interface
    712:      */
    713:     public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    714:     {
    715:         $tableMap = $this->getTableMap();
    716:         $relationMap = $tableMap->getRelation('Feature');
    717:
    718:         // create a ModelJoin object for this join
    719:         $join = new ModelJoin();
    720:         $join->setJoinType($joinType);
    721:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    722:         if ($previousJoin = $this->getPreviousJoin()) {
    723:             $join->setPreviousJoin($previousJoin);
    724:         }
    725:
    726:         // add the ModelJoin to the current object
    727:         if ($relationAlias) {
    728:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    729:             $this->addJoinObject($join, $relationAlias);
    730:         } else {
    731:             $this->addJoinObject($join, 'Feature');
    732:         }
    733:
    734:         return $this;
    735:     }
    736:
    737:     /**
    738:      * Use the Feature relation Feature object
    739:      *
    740:      * @see       useQuery()
    741:      *
    742:      * @param     string $relationAlias optional alias for the relation,
    743:      *                                   to be used as main alias in the secondary query
    744:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    745:      *
    746:      * @return   \Thelia\Model\FeatureQuery A secondary query class using the current class as primary query
    747:      */
    748:     public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    749:     {
    750:         return $this
    751:             ->joinFeature($relationAlias, $joinType)
    752:             ->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
    753:     }
    754:
    755:     /**
    756:      * Filter the query by a related FeatureAv object
    757:      *
    758:      * @param   FeatureAv|PropelObjectCollection $featureAv The related object(s) to use as filter
    759:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    760:      *
    761:      * @return                 FeatureProdQuery The current query, for fluid interface
    762:      * @throws PropelException - if the provided filter is invalid.
    763:      */
    764:     public function filterByFeatureAv($featureAv, $comparison = null)
    765:     {
    766:         if ($featureAv instanceof FeatureAv) {
    767:             return $this
    768:                 ->addUsingAlias(FeatureProdPeer::FEATURE_AV_ID, $featureAv->getId(), $comparison);
    769:         } elseif ($featureAv instanceof PropelObjectCollection) {
    770:             if (null === $comparison) {
    771:                 $comparison = Criteria::IN;
    772:             }
    773:
    774:             return $this
    775:                 ->addUsingAlias(FeatureProdPeer::FEATURE_AV_ID, $featureAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
    776:         } else {
    777:             throw new PropelException('filterByFeatureAv() only accepts arguments of type FeatureAv or PropelCollection');
    778:         }
    779:     }
    780:
    781:     /**
    782:      * Adds a JOIN clause to the query using the FeatureAv relation
    783:      *
    784:      * @param     string $relationAlias optional alias for the relation
    785:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    786:      *
    787:      * @return FeatureProdQuery The current query, for fluid interface
    788:      */
    789:     public function joinFeatureAv($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    790:     {
    791:         $tableMap = $this->getTableMap();
    792:         $relationMap = $tableMap->getRelation('FeatureAv');
    793:
    794:         // create a ModelJoin object for this join
    795:         $join = new ModelJoin();
    796:         $join->setJoinType($joinType);
    797:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    798:         if ($previousJoin = $this->getPreviousJoin()) {
    799:             $join->setPreviousJoin($previousJoin);
    800:         }
    801:
    802:         // add the ModelJoin to the current object
    803:         if ($relationAlias) {
    804:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    805:             $this->addJoinObject($join, $relationAlias);
    806:         } else {
    807:             $this->addJoinObject($join, 'FeatureAv');
    808:         }
    809:
    810:         return $this;
    811:     }
    812:
    813:     /**
    814:      * Use the FeatureAv relation FeatureAv object
    815:      *
    816:      * @see       useQuery()
    817:      *
    818:      * @param     string $relationAlias optional alias for the relation,
    819:      *                                   to be used as main alias in the secondary query
    820:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    821:      *
    822:      * @return   \Thelia\Model\FeatureAvQuery A secondary query class using the current class as primary query
    823:      */
    824:     public function useFeatureAvQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    825:     {
    826:         return $this
    827:             ->joinFeatureAv($relationAlias, $joinType)
    828:             ->useQuery($relationAlias ? $relationAlias : 'FeatureAv', '\Thelia\Model\FeatureAvQuery');
    829:     }
    830:
    831:     /**
    832:      * Exclude object from result
    833:      *
    834:      * @param   FeatureProd $featureProd Object to remove from the list of results
    835:      *
    836:      * @return FeatureProdQuery The current query, for fluid interface
    837:      */
    838:     public function prune($featureProd = null)
    839:     {
    840:         if ($featureProd) {
    841:             $this->addUsingAlias(FeatureProdPeer::ID, $featureProd->getId(), Criteria::NOT_EQUAL);
    842:         }
    843:
    844:         return $this;
    845:     }
    846:
    847:     // timestampable behavior
    848:
    849:     /**
    850:      * Filter by the latest updated
    851:      *
    852:      * @param      int $nbDays Maximum age of the latest update in days
    853:      *
    854:      * @return     FeatureProdQuery The current query, for fluid interface
    855:      */
    856:     public function recentlyUpdated($nbDays = 7)
    857:     {
    858:         return $this->addUsingAlias(FeatureProdPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    859:     }
    860:
    861:     /**
    862:      * Order by update date desc
    863:      *
    864:      * @return     FeatureProdQuery The current query, for fluid interface
    865:      */
    866:     public function lastUpdatedFirst()
    867:     {
    868:         return $this->addDescendingOrderByColumn(FeatureProdPeer::UPDATED_AT);
    869:     }
    870:
    871:     /**
    872:      * Order by update date asc
    873:      *
    874:      * @return     FeatureProdQuery The current query, for fluid interface
    875:      */
    876:     public function firstUpdatedFirst()
    877:     {
    878:         return $this->addAscendingOrderByColumn(FeatureProdPeer::UPDATED_AT);
    879:     }
    880:
    881:     /**
    882:      * Filter by the latest created
    883:      *
    884:      * @param      int $nbDays Maximum age of in days
    885:      *
    886:      * @return     FeatureProdQuery The current query, for fluid interface
    887:      */
    888:     public function recentlyCreated($nbDays = 7)
    889:     {
    890:         return $this->addUsingAlias(FeatureProdPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    891:     }
    892:
    893:     /**
    894:      * Order by create date desc
    895:      *
    896:      * @return     FeatureProdQuery The current query, for fluid interface
    897:      */
    898:     public function lastCreatedFirst()
    899:     {
    900:         return $this->addDescendingOrderByColumn(FeatureProdPeer::CREATED_AT);
    901:     }
    902:
    903:     /**
    904:      * Order by create date asc
    905:      *
    906:      * @return     FeatureProdQuery The current query, for fluid interface
    907:      */
    908:     public function firstCreatedFirst()
    909:     {
    910:         return $this->addAscendingOrderByColumn(FeatureProdPeer::CREATED_AT);
    911:     }
    912: }
    913: