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