# File core/lib/Thelia/Model/om/BaseCategoryVersionQuery.php | thelia

      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:      * </code>
    279:      *
    280:      * @see       filterByCategory()
    281:      *
    282:      * @param     mixed $id The value to use as filter.
    283:      *              Use scalar values for equality.
    284:      *              Use array values for in_array() equivalent.
    285:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    286:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    287:      *
    288:      * @return CategoryVersionQuery The current query, for fluid interface
    289:      */
    290:     public function filterById($id = null, $comparison = null)
    291:     {
    292:         if (is_array($id) && null === $comparison) {
    293:             $comparison = Criteria::IN;
    294:         }
    295:
    296:         return $this->addUsingAlias(CategoryVersionPeer::ID, $id, $comparison);
    297:     }
    298:
    299:     /**
    300:      * Filter the query on the parent column
    301:      *
    302:      * Example usage:
    303:      * <code>
    304:      * $query->filterByParent(1234); // WHERE parent = 1234
    305:      * $query->filterByParent(array(12, 34)); // WHERE parent IN (12, 34)
    306:      * $query->filterByParent(array('min' => 12)); // WHERE parent > 12
    307:      * </code>
    308:      *
    309:      * @param     mixed $parent The value to use as filter.
    310:      *              Use scalar values for equality.
    311:      *              Use array values for in_array() equivalent.
    312:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    313:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    314:      *
    315:      * @return CategoryVersionQuery The current query, for fluid interface
    316:      */
    317:     public function filterByParent($parent = null, $comparison = null)
    318:     {
    319:         if (is_array($parent)) {
    320:             $useMinMax = false;
    321:             if (isset($parent['min'])) {
    322:                 $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL);
    323:                 $useMinMax = true;
    324:             }
    325:             if (isset($parent['max'])) {
    326:                 $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL);
    327:                 $useMinMax = true;
    328:             }
    329:             if ($useMinMax) {
    330:                 return $this;
    331:             }
    332:             if (null === $comparison) {
    333:                 $comparison = Criteria::IN;
    334:             }
    335:         }
    336:
    337:         return $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent, $comparison);
    338:     }
    339:
    340:     /**
    341:      * Filter the query on the link column
    342:      *
    343:      * Example usage:
    344:      * <code>
    345:      * $query->filterByLink('fooValue');   // WHERE link = 'fooValue'
    346:      * $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
    347:      * </code>
    348:      *
    349:      * @param     string $link The value to use as filter.
    350:      *              Accepts wildcards (* and % trigger a LIKE)
    351:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    352:      *
    353:      * @return CategoryVersionQuery The current query, for fluid interface
    354:      */
    355:     public function filterByLink($link = null, $comparison = null)
    356:     {
    357:         if (null === $comparison) {
    358:             if (is_array($link)) {
    359:                 $comparison = Criteria::IN;
    360:             } elseif (preg_match('/[\%\*]/', $link)) {
    361:                 $link = str_replace('*', '%', $link);
    362:                 $comparison = Criteria::LIKE;
    363:             }
    364:         }
    365:
    366:         return $this->addUsingAlias(CategoryVersionPeer::LINK, $link, $comparison);
    367:     }
    368:
    369:     /**
    370:      * Filter the query on the visible column
    371:      *
    372:      * Example usage:
    373:      * <code>
    374:      * $query->filterByVisible(1234); // WHERE visible = 1234
    375:      * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
    376:      * $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
    377:      * </code>
    378:      *
    379:      * @param     mixed $visible The value to use as filter.
    380:      *              Use scalar values for equality.
    381:      *              Use array values for in_array() equivalent.
    382:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    383:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    384:      *
    385:      * @return CategoryVersionQuery The current query, for fluid interface
    386:      */
    387:     public function filterByVisible($visible = null, $comparison = null)
    388:     {
    389:         if (is_array($visible)) {
    390:             $useMinMax = false;
    391:             if (isset($visible['min'])) {
    392:                 $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
    393:                 $useMinMax = true;
    394:             }
    395:             if (isset($visible['max'])) {
    396:                 $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
    397:                 $useMinMax = true;
    398:             }
    399:             if ($useMinMax) {
    400:                 return $this;
    401:             }
    402:             if (null === $comparison) {
    403:                 $comparison = Criteria::IN;
    404:             }
    405:         }
    406:
    407:         return $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible, $comparison);
    408:     }
    409:
    410:     /**
    411:      * Filter the query on the position column
    412:      *
    413:      * Example usage:
    414:      * <code>
    415:      * $query->filterByPosition(1234); // WHERE position = 1234
    416:      * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
    417:      * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
    418:      * </code>
    419:      *
    420:      * @param     mixed $position The value to use as filter.
    421:      *              Use scalar values for equality.
    422:      *              Use array values for in_array() equivalent.
    423:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    424:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    425:      *
    426:      * @return CategoryVersionQuery The current query, for fluid interface
    427:      */
    428:     public function filterByPosition($position = null, $comparison = null)
    429:     {
    430:         if (is_array($position)) {
    431:             $useMinMax = false;
    432:             if (isset($position['min'])) {
    433:                 $this->addUsingAlias(CategoryVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
    434:                 $useMinMax = true;
    435:             }
    436:             if (isset($position['max'])) {
    437:                 $this->addUsingAlias(CategoryVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
    438:                 $useMinMax = true;
    439:             }
    440:             if ($useMinMax) {
    441:                 return $this;
    442:             }
    443:             if (null === $comparison) {
    444:                 $comparison = Criteria::IN;
    445:             }
    446:         }
    447:
    448:         return $this->addUsingAlias(CategoryVersionPeer::POSITION, $position, $comparison);
    449:     }
    450:
    451:     /**
    452:      * Filter the query on the created_at column
    453:      *
    454:      * Example usage:
    455:      * <code>
    456:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    457:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    458:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    459:      * </code>
    460:      *
    461:      * @param     mixed $createdAt The value to use as filter.
    462:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    463:      *              Empty strings are treated as NULL.
    464:      *              Use scalar values for equality.
    465:      *              Use array values for in_array() equivalent.
    466:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    467:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    468:      *
    469:      * @return CategoryVersionQuery The current query, for fluid interface
    470:      */
    471:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    472:     {
    473:         if (is_array($createdAt)) {
    474:             $useMinMax = false;
    475:             if (isset($createdAt['min'])) {
    476:                 $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    477:                 $useMinMax = true;
    478:             }
    479:             if (isset($createdAt['max'])) {
    480:                 $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    481:                 $useMinMax = true;
    482:             }
    483:             if ($useMinMax) {
    484:                 return $this;
    485:             }
    486:             if (null === $comparison) {
    487:                 $comparison = Criteria::IN;
    488:             }
    489:         }
    490:
    491:         return $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt, $comparison);
    492:     }
    493:
    494:     /**
    495:      * Filter the query on the updated_at column
    496:      *
    497:      * Example usage:
    498:      * <code>
    499:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    500:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    501:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    502:      * </code>
    503:      *
    504:      * @param     mixed $updatedAt The value to use as filter.
    505:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    506:      *              Empty strings are treated as NULL.
    507:      *              Use scalar values for equality.
    508:      *              Use array values for in_array() equivalent.
    509:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    510:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    511:      *
    512:      * @return CategoryVersionQuery The current query, for fluid interface
    513:      */
    514:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    515:     {
    516:         if (is_array($updatedAt)) {
    517:             $useMinMax = false;
    518:             if (isset($updatedAt['min'])) {
    519:                 $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    520:                 $useMinMax = true;
    521:             }
    522:             if (isset($updatedAt['max'])) {
    523:                 $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    524:                 $useMinMax = true;
    525:             }
    526:             if ($useMinMax) {
    527:                 return $this;
    528:             }
    529:             if (null === $comparison) {
    530:                 $comparison = Criteria::IN;
    531:             }
    532:         }
    533:
    534:         return $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt, $comparison);
    535:     }
    536:
    537:     /**
    538:      * Filter the query on the version column
    539:      *
    540:      * Example usage:
    541:      * <code>
    542:      * $query->filterByVersion(1234); // WHERE version = 1234
    543:      * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
    544:      * $query->filterByVersion(array('min' => 12)); // WHERE version > 12
    545:      * </code>
    546:      *
    547:      * @param     mixed $version The value to use as filter.
    548:      *              Use scalar values for equality.
    549:      *              Use array values for in_array() equivalent.
    550:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    551:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    552:      *
    553:      * @return CategoryVersionQuery The current query, for fluid interface
    554:      */
    555:     public function filterByVersion($version = null, $comparison = null)
    556:     {
    557:         if (is_array($version) && null === $comparison) {
    558:             $comparison = Criteria::IN;
    559:         }
    560:
    561:         return $this->addUsingAlias(CategoryVersionPeer::VERSION, $version, $comparison);
    562:     }
    563:
    564:     /**
    565:      * Filter the query on the version_created_at column
    566:      *
    567:      * Example usage:
    568:      * <code>
    569:      * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
    570:      * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
    571:      * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
    572:      * </code>
    573:      *
    574:      * @param     mixed $versionCreatedAt The value to use as filter.
    575:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    576:      *              Empty strings are treated as NULL.
    577:      *              Use scalar values for equality.
    578:      *              Use array values for in_array() equivalent.
    579:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    580:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    581:      *
    582:      * @return CategoryVersionQuery The current query, for fluid interface
    583:      */
    584:     public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
    585:     {
    586:         if (is_array($versionCreatedAt)) {
    587:             $useMinMax = false;
    588:             if (isset($versionCreatedAt['min'])) {
    589:                 $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
    590:                 $useMinMax = true;
    591:             }
    592:             if (isset($versionCreatedAt['max'])) {
    593:                 $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
    594:                 $useMinMax = true;
    595:             }
    596:             if ($useMinMax) {
    597:                 return $this;
    598:             }
    599:             if (null === $comparison) {
    600:                 $comparison = Criteria::IN;
    601:             }
    602:         }
    603:
    604:         return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
    605:     }
    606:
    607:     /**
    608:      * Filter the query on the version_created_by column
    609:      *
    610:      * Example usage:
    611:      * <code>
    612:      * $query->filterByVersionCreatedBy('fooValue');   // WHERE version_created_by = 'fooValue'
    613:      * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
    614:      * </code>
    615:      *
    616:      * @param     string $versionCreatedBy The value to use as filter.
    617:      *              Accepts wildcards (* and % trigger a LIKE)
    618:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    619:      *
    620:      * @return CategoryVersionQuery The current query, for fluid interface
    621:      */
    622:     public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
    623:     {
    624:         if (null === $comparison) {
    625:             if (is_array($versionCreatedBy)) {
    626:                 $comparison = Criteria::IN;
    627:             } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
    628:                 $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
    629:                 $comparison = Criteria::LIKE;
    630:             }
    631:         }
    632:
    633:         return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
    634:     }
    635:
    636:     /**
    637:      * Filter the query by a related Category object
    638:      *
    639:      * @param   Category|PropelObjectCollection $category The related object(s) to use as filter
    640:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    641:      *
    642:      * @return   CategoryVersionQuery The current query, for fluid interface
    643:      * @throws   PropelException - if the provided filter is invalid.
    644:      */
    645:     public function filterByCategory($category, $comparison = null)
    646:     {
    647:         if ($category instanceof Category) {
    648:             return $this
    649:                 ->addUsingAlias(CategoryVersionPeer::ID, $category->getId(), $comparison);
    650:         } elseif ($category instanceof PropelObjectCollection) {
    651:             if (null === $comparison) {
    652:                 $comparison = Criteria::IN;
    653:             }
    654:
    655:             return $this
    656:                 ->addUsingAlias(CategoryVersionPeer::ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
    657:         } else {
    658:             throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
    659:         }
    660:     }
    661:
    662:     /**
    663:      * Adds a JOIN clause to the query using the Category relation
    664:      *
    665:      * @param     string $relationAlias optional alias for the relation
    666:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    667:      *
    668:      * @return CategoryVersionQuery The current query, for fluid interface
    669:      */
    670:     public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    671:     {
    672:         $tableMap = $this->getTableMap();
    673:         $relationMap = $tableMap->getRelation('Category');
    674:
    675:         // create a ModelJoin object for this join
    676:         $join = new ModelJoin();
    677:         $join->setJoinType($joinType);
    678:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    679:         if ($previousJoin = $this->getPreviousJoin()) {
    680:             $join->setPreviousJoin($previousJoin);
    681:         }
    682:
    683:         // add the ModelJoin to the current object
    684:         if ($relationAlias) {
    685:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    686:             $this->addJoinObject($join, $relationAlias);
    687:         } else {
    688:             $this->addJoinObject($join, 'Category');
    689:         }
    690:
    691:         return $this;
    692:     }
    693:
    694:     /**
    695:      * Use the Category relation Category object
    696:      *
    697:      * @see       useQuery()
    698:      *
    699:      * @param     string $relationAlias optional alias for the relation,
    700:      *                                   to be used as main alias in the secondary query
    701:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    702:      *
    703:      * @return   \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
    704:      */
    705:     public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    706:     {
    707:         return $this
    708:             ->joinCategory($relationAlias, $joinType)
    709:             ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
    710:     }
    711:
    712:     /**
    713:      * Exclude object from result
    714:      *
    715:      * @param   CategoryVersion $categoryVersion Object to remove from the list of results
    716:      *
    717:      * @return CategoryVersionQuery The current query, for fluid interface
    718:      */
    719:     public function prune($categoryVersion = null)
    720:     {
    721:         if ($categoryVersion) {
    722:             $this->addCond('pruneCond0', $this->getAliasedColName(CategoryVersionPeer::ID), $categoryVersion->getId(), Criteria::NOT_EQUAL);
    723:             $this->addCond('pruneCond1', $this->getAliasedColName(CategoryVersionPeer::VERSION), $categoryVersion->getVersion(), Criteria::NOT_EQUAL);
    724:             $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
    725:         }
    726:
    727:         return $this;
    728:     }
    729:
    730: }
    731: