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