      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\CategoryVersion;
     17: use Thelia\Model\CategoryVersionPeer;
     18: use Thelia\Model\CategoryVersionQuery;
     19:
     20: /**
     21:  * Base class that represents a query for the 'category_version' table.
     22:  *
     23:  *
     24:  *
     25:  * @method CategoryVersionQuery orderById($order = Criteria::ASC) Order by the id column
     26:  * @method CategoryVersionQuery orderByParent($order = Criteria::ASC) Order by the parent column
     27:  * @method CategoryVersionQuery orderByLink($order = Criteria::ASC) Order by the link column
     28:  * @method CategoryVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
     29:  * @method CategoryVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
     30:  * @method CategoryVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     31:  * @method CategoryVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     32:  * @method CategoryVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
     33:  * @method CategoryVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
     34:  * @method CategoryVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
     35:  *
     36:  * @method CategoryVersionQuery groupById() Group by the id column
     37:  * @method CategoryVersionQuery groupByParent() Group by the parent column
     38:  * @method CategoryVersionQuery groupByLink() Group by the link column
     39:  * @method CategoryVersionQuery groupByVisible() Group by the visible column
     40:  * @method CategoryVersionQuery groupByPosition() Group by the position column
     41:  * @method CategoryVersionQuery groupByCreatedAt() Group by the created_at column
     42:  * @method CategoryVersionQuery groupByUpdatedAt() Group by the updated_at column
     43:  * @method CategoryVersionQuery groupByVersion() Group by the version column
     44:  * @method CategoryVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
     45:  * @method CategoryVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
     46:  *
     47:  * @method CategoryVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     48:  * @method CategoryVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     49:  * @method CategoryVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     50:  *
     51:  * @method CategoryVersionQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
     52:  * @method CategoryVersionQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
     53:  * @method CategoryVersionQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
     54:  *
     55:  * @method CategoryVersion findOne(PropelPDO $con = null) Return the first CategoryVersion matching the query
     56:  * @method CategoryVersion findOneOrCreate(PropelPDO $con = null) Return the first CategoryVersion matching the query, or a new CategoryVersion object populated from the query conditions when no match is found
     57:  *
     58:  * @method CategoryVersion findOneById(int $id) Return the first CategoryVersion filtered by the id column
     59:  * @method CategoryVersion findOneByParent(int $parent) Return the first CategoryVersion filtered by the parent column
     60:  * @method CategoryVersion findOneByLink(string $link) Return the first CategoryVersion filtered by the link column
     61:  * @method CategoryVersion findOneByVisible(int $visible) Return the first CategoryVersion filtered by the visible column
     62:  * @method CategoryVersion findOneByPosition(int $position) Return the first CategoryVersion filtered by the position column
     63:  * @method CategoryVersion findOneByCreatedAt(string $created_at) Return the first CategoryVersion filtered by the created_at column
     64:  * @method CategoryVersion findOneByUpdatedAt(string $updated_at) Return the first CategoryVersion filtered by the updated_at column
     65:  * @method CategoryVersion findOneByVersion(int $version) Return the first CategoryVersion filtered by the version column
     66:  * @method CategoryVersion findOneByVersionCreatedAt(string $version_created_at) Return the first CategoryVersion filtered by the version_created_at column
     67:  * @method CategoryVersion findOneByVersionCreatedBy(string $version_created_by) Return the first CategoryVersion filtered by the version_created_by column
     68:  *
     69:  * @method array findById(int $id) Return CategoryVersion objects filtered by the id column
     70:  * @method array findByParent(int $parent) Return CategoryVersion objects filtered by the parent column
     71:  * @method array findByLink(string $link) Return CategoryVersion objects filtered by the link column
     72:  * @method array findByVisible(int $visible) Return CategoryVersion objects filtered by the visible column
     73:  * @method array findByPosition(int $position) Return CategoryVersion objects filtered by the position column
     74:  * @method array findByCreatedAt(string $created_at) Return CategoryVersion objects filtered by the created_at column
     75:  * @method array findByUpdatedAt(string $updated_at) Return CategoryVersion objects filtered by the updated_at column
     76:  * @method array findByVersion(int $version) Return CategoryVersion objects filtered by the version column
     77:  * @method array findByVersionCreatedAt(string $version_created_at) Return CategoryVersion objects filtered by the version_created_at column
     78:  * @method array findByVersionCreatedBy(string $version_created_by) Return CategoryVersion objects filtered by the version_created_by column
     79:  *
     80:  * @package    propel.generator.Thelia.Model.om
     81:  */
     82: abstract class BaseCategoryVersionQuery extends ModelCriteria
     83: {
     84:     /**
     85:      * Initializes internal state of BaseCategoryVersionQuery object.
     86:      *
     87:      * @param     string $dbName The dabase name
     88:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     89:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     90:      */
     91:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CategoryVersion', $modelAlias = null)
     92:     {
     93:         parent::__construct($dbName, $modelName, $modelAlias);
     94:     }
     95:
     96:     /**
     97:      * Returns a new CategoryVersionQuery object.
     98:      *
     99:      * @param     string $modelAlias The alias of a model in the query
    100:      * @param   CategoryVersionQuery|Criteria $criteria Optional Criteria to build the query from
    101:      *
    102:      * @return CategoryVersionQuery
    103:      */
    104:     public static function create($modelAlias = null, $criteria = null)
    105:     {
    106:         if ($criteria instanceof CategoryVersionQuery) {
    107:             return $criteria;
    108:         }
    109:         $query = new CategoryVersionQuery();
    110:         if (null !== $modelAlias) {
    111:             $query->setModelAlias($modelAlias);
    112:         }
    113:         if ($criteria instanceof Criteria) {
    114:             $query->mergeWith($criteria);
    115:         }
    116:
    117:         return $query;
    118:     }
    119:
    120:     /**
    121:      * Find object by primary key.
    122:      * Propel uses the instance pool to skip the database if the object exists.
    123:      * Go fast if the query is untouched.
    124:      *
    125:      * <code>
    126:      * $obj = $c->findPk(array(12, 34), $con);
    127:      * </code>
    128:      *
    129:      * @param array $key Primary key to use for the query
    130:                          A Primary key composition: [$id, $version]
    131:      * @param     PropelPDO $con an optional connection object
    132:      *
    133:      * @return   CategoryVersion|CategoryVersion[]|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 = CategoryVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
    141:             // the object is alredy in the instance pool
    142:             return $obj;
    143:         }
    144:         if ($con === null) {
    145:             $con = Propel::getConnection(CategoryVersionPeer::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:      * Find object by primary key using raw SQL to go fast.
    159:      * Bypass doSelect() and the object formatter by using generated code.
    160:      *
    161:      * @param     mixed $key Primary key to use for the query
    162:      * @param     PropelPDO $con A connection object
    163:      *
    164:      * @return                 CategoryVersion A model object, or null if the key is not found
    165:      * @throws PropelException
    166:      */
    167:     protected function findPkSimple($key, $con)
    168:     {
    169:         $sql = 'SELECT `id`, `parent`, `link`, `visible`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `category_version` WHERE `id` = :p0 AND `version` = :p1';
    170:         try {
    171:             $stmt = $con->prepare($sql);
    172:             $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
    173:             $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
    174:             $stmt->execute();
    175:         } catch (Exception $e) {
    176:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    177:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    178:         }
    179:         $obj = null;
    180:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    181:             $obj = new CategoryVersion();
    182:             $obj->hydrate($row);
    183:             CategoryVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
    184:         }
    185:         $stmt->closeCursor();
    186:
    187:         return $obj;
    188:     }
    189:
    190:     /**
    191:      * Find object by primary key.
    192:      *
    193:      * @param     mixed $key Primary key to use for the query
    194:      * @param     PropelPDO $con A connection object
    195:      *
    196:      * @return CategoryVersion|CategoryVersion[]|mixed the result, formatted by the current formatter
    197:      */
    198:     protected function findPkComplex($key, $con)
    199:     {
    200:         // As the query uses a PK condition, no limit(1) is necessary.
    201:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    202:         $stmt = $criteria
    203:             ->filterByPrimaryKey($key)
    204:             ->doSelect($con);
    205:
    206:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    207:     }
    208:
    209:     /**
    210:      * Find objects by primary key
    211:      * <code>
    212:      * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
    213:      * </code>
    214:      * @param     array $keys Primary keys to use for the query
    215:      * @param     PropelPDO $con an optional connection object
    216:      *
    217:      * @return PropelObjectCollection|CategoryVersion[]|mixed the list of results, formatted by the current formatter
    218:      */
    219:     public function findPks($keys, $con = null)
    220:     {
    221:         if ($con === null) {
    222:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    223:         }
    224:         $this->basePreSelect($con);
    225:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    226:         $stmt = $criteria
    227:             ->filterByPrimaryKeys($keys)
    228:             ->doSelect($con);
    229:
    230:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    231:     }
    232:
    233:     /**
    234:      * Filter the query by primary key
    235:      *
    236:      * @param     mixed $key Primary key to use for the query
    237:      *
    238:      * @return CategoryVersionQuery The current query, for fluid interface
    239:      */
    240:     public function filterByPrimaryKey($key)
    241:     {
    242:         $this->addUsingAlias(CategoryVersionPeer::ID, $key[0], Criteria::EQUAL);
    243:         $this->addUsingAlias(CategoryVersionPeer::VERSION, $key[1], Criteria::EQUAL);
    244:
    245:         return $this;
    246:     }
    247:
    248:     /**
    249:      * Filter the query by a list of primary keys
    250:      *
    251:      * @param     array $keys The list of primary key to use for the query
    252:      *
    253:      * @return CategoryVersionQuery The current query, for fluid interface
    254:      */
    255:     public function filterByPrimaryKeys($keys)
    256:     {
    257:         if (empty($keys)) {
    258:             return $this->add(null, '1<>1', Criteria::CUSTOM);
    259:         }
    260:         foreach ($keys as $key) {
    261:             $cton0 = $this->getNewCriterion(CategoryVersionPeer::ID, $key[0], Criteria::EQUAL);
    262:             $cton1 = $this->getNewCriterion(CategoryVersionPeer::VERSION, $key[1], Criteria::EQUAL);
    263:             $cton0->addAnd($cton1);
    264:             $this->addOr($cton0);
    265:         }
    266:
    267:         return $this;
    268:     }
    269:
    270:     /**
    271:      * Filter the query on the id column
    272:      *
    273:      * Example usage:
    274:      * <code>
    275:      * $query->filterById(1234); // WHERE id = 1234
    276:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    277:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
    278:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
    279:      * </code>
    280:      *
    281:      * @see       filterByCategory()
    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 CategoryVersionQuery 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(CategoryVersionPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
    297:                 $useMinMax = true;
    298:             }
    299:             if (isset($id['max'])) {
    300:                 $this->addUsingAlias(CategoryVersionPeer::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(CategoryVersionPeer::ID, $id, $comparison);
    312:     }
    313:
    314:     /**
    315:      * Filter the query on the parent column
    316:      *
    317:      * Example usage:
    318:      * <code>
    319:      * $query->filterByParent(1234); // WHERE parent = 1234
    320:      * $query->filterByParent(array(12, 34)); // WHERE parent IN (12, 34)
    321:      * $query->filterByParent(array('min' => 12)); // WHERE parent >= 12
    322:      * $query->filterByParent(array('max' => 12)); // WHERE parent <= 12
    323:      * </code>
    324:      *
    325:      * @param     mixed $parent The value to use as filter.
    326:      *              Use scalar values for equality.
    327:      *              Use array values for in_array() equivalent.
    328:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    329:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    330:      *
    331:      * @return CategoryVersionQuery The current query, for fluid interface
    332:      */
    333:     public function filterByParent($parent = null, $comparison = null)
    334:     {
    335:         if (is_array($parent)) {
    336:             $useMinMax = false;
    337:             if (isset($parent['min'])) {
    338:                 $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL);
    339:                 $useMinMax = true;
    340:             }
    341:             if (isset($parent['max'])) {
    342:                 $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL);
    343:                 $useMinMax = true;
    344:             }
    345:             if ($useMinMax) {
    346:                 return $this;
    347:             }
    348:             if (null === $comparison) {
    349:                 $comparison = Criteria::IN;
    350:             }
    351:         }
    352:
    353:         return $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent, $comparison);
    354:     }
    355:
    356:     /**
    357:      * Filter the query on the link column
    358:      *
    359:      * Example usage:
    360:      * <code>
    361:      * $query->filterByLink('fooValue');   // WHERE link = 'fooValue'
    362:      * $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
    363:      * </code>
    364:      *
    365:      * @param     string $link The value to use as filter.
    366:      *              Accepts wildcards (* and % trigger a LIKE)
    367:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    368:      *
    369:      * @return CategoryVersionQuery The current query, for fluid interface
    370:      */
    371:     public function filterByLink($link = null, $comparison = null)
    372:     {
    373:         if (null === $comparison) {
    374:             if (is_array($link)) {
    375:                 $comparison = Criteria::IN;
    376:             } elseif (preg_match('/[\%\*]/', $link)) {
    377:                 $link = str_replace('*', '%', $link);
    378:                 $comparison = Criteria::LIKE;
    379:             }
    380:         }
    381:
    382:         return $this->addUsingAlias(CategoryVersionPeer::LINK, $link, $comparison);
    383:     }
    384:
    385:     /**
    386:      * Filter the query on the visible column
    387:      *
    388:      * Example usage:
    389:      * <code>
    390:      * $query->filterByVisible(1234); // WHERE visible = 1234
    391:      * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
    392:      * $query->filterByVisible(array('min' => 12)); // WHERE visible >= 12
    393:      * $query->filterByVisible(array('max' => 12)); // WHERE visible <= 12
    394:      * </code>
    395:      *
    396:      * @param     mixed $visible The value to use as filter.
    397:      *              Use scalar values for equality.
    398:      *              Use array values for in_array() equivalent.
    399:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    400:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    401:      *
    402:      * @return CategoryVersionQuery The current query, for fluid interface
    403:      */
    404:     public function filterByVisible($visible = null, $comparison = null)
    405:     {
    406:         if (is_array($visible)) {
    407:             $useMinMax = false;
    408:             if (isset($visible['min'])) {
    409:                 $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
    410:                 $useMinMax = true;
    411:             }
    412:             if (isset($visible['max'])) {
    413:                 $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
    414:                 $useMinMax = true;
    415:             }
    416:             if ($useMinMax) {
    417:                 return $this;
    418:             }
    419:             if (null === $comparison) {
    420:                 $comparison = Criteria::IN;
    421:             }
    422:         }
    423:
    424:         return $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible, $comparison);
    425:     }
    426:
    427:     /**
    428:      * Filter the query on the position column
    429:      *
    430:      * Example usage:
    431:      * <code>
    432:      * $query->filterByPosition(1234); // WHERE position = 1234
    433:      * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
    434:      * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
    435:      * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
    436:      * </code>
    437:      *
    438:      * @param     mixed $position The value to use as filter.
    439:      *              Use scalar values for equality.
    440:      *              Use array values for in_array() equivalent.
    441:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    442:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    443:      *
    444:      * @return CategoryVersionQuery The current query, for fluid interface
    445:      */
    446:     public function filterByPosition($position = null, $comparison = null)
    447:     {
    448:         if (is_array($position)) {
    449:             $useMinMax = false;
    450:             if (isset($position['min'])) {
    451:                 $this->addUsingAlias(CategoryVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
    452:                 $useMinMax = true;
    453:             }
    454:             if (isset($position['max'])) {
    455:                 $this->addUsingAlias(CategoryVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
    456:                 $useMinMax = true;
    457:             }
    458:             if ($useMinMax) {
    459:                 return $this;
    460:             }
    461:             if (null === $comparison) {
    462:                 $comparison = Criteria::IN;
    463:             }
    464:         }
    465:
    466:         return $this->addUsingAlias(CategoryVersionPeer::POSITION, $position, $comparison);
    467:     }
    468:
    469:     /**
    470:      * Filter the query on the created_at column
    471:      *
    472:      * Example usage:
    473:      * <code>
    474:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    475:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    476:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    477:      * </code>
    478:      *
    479:      * @param     mixed $createdAt The value to use as filter.
    480:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    481:      *              Empty strings are treated as NULL.
    482:      *              Use scalar values for equality.
    483:      *              Use array values for in_array() equivalent.
    484:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    485:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    486:      *
    487:      * @return CategoryVersionQuery The current query, for fluid interface
    488:      */
    489:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    490:     {
    491:         if (is_array($createdAt)) {
    492:             $useMinMax = false;
    493:             if (isset($createdAt['min'])) {
    494:                 $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    495:                 $useMinMax = true;
    496:             }
    497:             if (isset($createdAt['max'])) {
    498:                 $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    499:                 $useMinMax = true;
    500:             }
    501:             if ($useMinMax) {
    502:                 return $this;
    503:             }
    504:             if (null === $comparison) {
    505:                 $comparison = Criteria::IN;
    506:             }
    507:         }
    508:
    509:         return $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt, $comparison);
    510:     }
    511:
    512:     /**
    513:      * Filter the query on the updated_at column
    514:      *
    515:      * Example usage:
    516:      * <code>
    517:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    518:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    519:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    520:      * </code>
    521:      *
    522:      * @param     mixed $updatedAt The value to use as filter.
    523:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    524:      *              Empty strings are treated as NULL.
    525:      *              Use scalar values for equality.
    526:      *              Use array values for in_array() equivalent.
    527:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    528:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    529:      *
    530:      * @return CategoryVersionQuery The current query, for fluid interface
    531:      */
    532:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    533:     {
    534:         if (is_array($updatedAt)) {
    535:             $useMinMax = false;
    536:             if (isset($updatedAt['min'])) {
    537:                 $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    538:                 $useMinMax = true;
    539:             }
    540:             if (isset($updatedAt['max'])) {
    541:                 $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    542:                 $useMinMax = true;
    543:             }
    544:             if ($useMinMax) {
    545:                 return $this;
    546:             }
    547:             if (null === $comparison) {
    548:                 $comparison = Criteria::IN;
    549:             }
    550:         }
    551:
    552:         return $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt, $comparison);
    553:     }
    554:
    555:     /**
    556:      * Filter the query on the version column
    557:      *
    558:      * Example usage:
    559:      * <code>
    560:      * $query->filterByVersion(1234); // WHERE version = 1234
    561:      * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
    562:      * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12
    563:      * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12
    564:      * </code>
    565:      *
    566:      * @param     mixed $version The value to use as filter.
    567:      *              Use scalar values for equality.
    568:      *              Use array values for in_array() equivalent.
    569:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    570:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    571:      *
    572:      * @return CategoryVersionQuery The current query, for fluid interface
    573:      */
    574:     public function filterByVersion($version = null, $comparison = null)
    575:     {
    576:         if (is_array($version)) {
    577:             $useMinMax = false;
    578:             if (isset($version['min'])) {
    579:                 $this->addUsingAlias(CategoryVersionPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
    580:                 $useMinMax = true;
    581:             }
    582:             if (isset($version['max'])) {
    583:                 $this->addUsingAlias(CategoryVersionPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
    584:                 $useMinMax = true;
    585:             }
    586:             if ($useMinMax) {
    587:                 return $this;
    588:             }
    589:             if (null === $comparison) {
    590:                 $comparison = Criteria::IN;
    591:             }
    592:         }
    593:
    594:         return $this->addUsingAlias(CategoryVersionPeer::VERSION, $version, $comparison);
    595:     }
    596:
    597:     /**
    598:      * Filter the query on the version_created_at column
    599:      *
    600:      * Example usage:
    601:      * <code>
    602:      * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
    603:      * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
    604:      * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
    605:      * </code>
    606:      *
    607:      * @param     mixed $versionCreatedAt The value to use as filter.
    608:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    609:      *              Empty strings are treated as NULL.
    610:      *              Use scalar values for equality.
    611:      *              Use array values for in_array() equivalent.
    612:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    613:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    614:      *
    615:      * @return CategoryVersionQuery The current query, for fluid interface
    616:      */
    617:     public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
    618:     {
    619:         if (is_array($versionCreatedAt)) {
    620:             $useMinMax = false;
    621:             if (isset($versionCreatedAt['min'])) {
    622:                 $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
    623:                 $useMinMax = true;
    624:             }
    625:             if (isset($versionCreatedAt['max'])) {
    626:                 $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
    627:                 $useMinMax = true;
    628:             }
    629:             if ($useMinMax) {
    630:                 return $this;
    631:             }
    632:             if (null === $comparison) {
    633:                 $comparison = Criteria::IN;
    634:             }
    635:         }
    636:
    637:         return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
    638:     }
    639:
    640:     /**
    641:      * Filter the query on the version_created_by column
    642:      *
    643:      * Example usage:
    644:      * <code>
    645:      * $query->filterByVersionCreatedBy('fooValue');   // WHERE version_created_by = 'fooValue'
    646:      * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
    647:      * </code>
    648:      *
    649:      * @param     string $versionCreatedBy The value to use as filter.
    650:      *              Accepts wildcards (* and % trigger a LIKE)
    651:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    652:      *
    653:      * @return CategoryVersionQuery The current query, for fluid interface
    654:      */
    655:     public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
    656:     {
    657:         if (null === $comparison) {
    658:             if (is_array($versionCreatedBy)) {
    659:                 $comparison = Criteria::IN;
    660:             } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
    661:                 $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
    662:                 $comparison = Criteria::LIKE;
    663:             }
    664:         }
    665:
    666:         return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
    667:     }
    668:
    669:     /**
    670:      * Filter the query by a related Category object
    671:      *
    672:      * @param   Category|PropelObjectCollection $category The related object(s) to use as filter
    673:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    674:      *
    675:      * @return                 CategoryVersionQuery The current query, for fluid interface
    676:      * @throws PropelException - if the provided filter is invalid.
    677:      */
    678:     public function filterByCategory($category, $comparison = null)
    679:     {
    680:         if ($category instanceof Category) {
    681:             return $this
    682:                 ->addUsingAlias(CategoryVersionPeer::ID, $category->getId(), $comparison);
    683:         } elseif ($category instanceof PropelObjectCollection) {
    684:             if (null === $comparison) {
    685:                 $comparison = Criteria::IN;
    686:             }
    687:
    688:             return $this
    689:                 ->addUsingAlias(CategoryVersionPeer::ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
    690:         } else {
    691:             throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
    692:         }
    693:     }
    694:
    695:     /**
    696:      * Adds a JOIN clause to the query using the Category relation
    697:      *
    698:      * @param     string $relationAlias optional alias for the relation
    699:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    700:      *
    701:      * @return CategoryVersionQuery The current query, for fluid interface
    702:      */
    703:     public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    704:     {
    705:         $tableMap = $this->getTableMap();
    706:         $relationMap = $tableMap->getRelation('Category');
    707:
    708:         // create a ModelJoin object for this join
    709:         $join = new ModelJoin();
    710:         $join->setJoinType($joinType);
    711:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    712:         if ($previousJoin = $this->getPreviousJoin()) {
    713:             $join->setPreviousJoin($previousJoin);
    714:         }
    715:
    716:         // add the ModelJoin to the current object
    717:         if ($relationAlias) {
    718:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    719:             $this->addJoinObject($join, $relationAlias);
    720:         } else {
    721:             $this->addJoinObject($join, 'Category');
    722:         }
    723:
    724:         return $this;
    725:     }
    726:
    727:     /**
    728:      * Use the Category relation Category object
    729:      *
    730:      * @see       useQuery()
    731:      *
    732:      * @param     string $relationAlias optional alias for the relation,
    733:      *                                   to be used as main alias in the secondary query
    734:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    735:      *
    736:      * @return   \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
    737:      */
    738:     public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    739:     {
    740:         return $this
    741:             ->joinCategory($relationAlias, $joinType)
    742:             ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
    743:     }
    744:
    745:     /**
    746:      * Exclude object from result
    747:      *
    748:      * @param   CategoryVersion $categoryVersion Object to remove from the list of results
    749:      *
    750:      * @return CategoryVersionQuery The current query, for fluid interface
    751:      */
    752:     public function prune($categoryVersion = null)
    753:     {
    754:         if ($categoryVersion) {
    755:             $this->addCond('pruneCond0', $this->getAliasedColName(CategoryVersionPeer::ID), $categoryVersion->getId(), Criteria::NOT_EQUAL);
    756:             $this->addCond('pruneCond1', $this->getAliasedColName(CategoryVersionPeer::VERSION), $categoryVersion->getVersion(), Criteria::NOT_EQUAL);
    757:             $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
    758:         }
    759:
    760:         return $this;
    761:     }
    762:
    763: }
    764: