       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\ContentAssoc;
      17: use Thelia\Model\ContentFolder;
      18: use Thelia\Model\ContentI18n;
      19: use Thelia\Model\ContentPeer;
      20: use Thelia\Model\ContentQuery;
      21: use Thelia\Model\ContentVersion;
      22: use Thelia\Model\Document;
      23: use Thelia\Model\Image;
      24: use Thelia\Model\Rewriting;
      25:
      26: /**
      27:  * Base class that represents a query for the 'content' table.
      28:  *
      29:  *
      30:  *
      31:  * @method ContentQuery orderById($order = Criteria::ASC) Order by the id column
      32:  * @method ContentQuery orderByVisible($order = Criteria::ASC) Order by the visible column
      33:  * @method ContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
      34:  * @method ContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
      35:  * @method ContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
      36:  * @method ContentQuery orderByVersion($order = Criteria::ASC) Order by the version column
      37:  * @method ContentQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
      38:  * @method ContentQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
      39:  *
      40:  * @method ContentQuery groupById() Group by the id column
      41:  * @method ContentQuery groupByVisible() Group by the visible column
      42:  * @method ContentQuery groupByPosition() Group by the position column
      43:  * @method ContentQuery groupByCreatedAt() Group by the created_at column
      44:  * @method ContentQuery groupByUpdatedAt() Group by the updated_at column
      45:  * @method ContentQuery groupByVersion() Group by the version column
      46:  * @method ContentQuery groupByVersionCreatedAt() Group by the version_created_at column
      47:  * @method ContentQuery groupByVersionCreatedBy() Group by the version_created_by column
      48:  *
      49:  * @method ContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
      50:  * @method ContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
      51:  * @method ContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
      52:  *
      53:  * @method ContentQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
      54:  * @method ContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
      55:  * @method ContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
      56:  *
      57:  * @method ContentQuery leftJoinImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Image relation
      58:  * @method ContentQuery rightJoinImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Image relation
      59:  * @method ContentQuery innerJoinImage($relationAlias = null) Adds a INNER JOIN clause to the query using the Image relation
      60:  *
      61:  * @method ContentQuery leftJoinDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the Document relation
      62:  * @method ContentQuery rightJoinDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Document relation
      63:  * @method ContentQuery innerJoinDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the Document relation
      64:  *
      65:  * @method ContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
      66:  * @method ContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
      67:  * @method ContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
      68:  *
      69:  * @method ContentQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation
      70:  * @method ContentQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation
      71:  * @method ContentQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation
      72:  *
      73:  * @method ContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation
      74:  * @method ContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
      75:  * @method ContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
      76:  *
      77:  * @method ContentQuery leftJoinContentVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentVersion relation
      78:  * @method ContentQuery rightJoinContentVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentVersion relation
      79:  * @method ContentQuery innerJoinContentVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentVersion relation
      80:  *
      81:  * @method Content findOne(PropelPDO $con = null) Return the first Content matching the query
      82:  * @method Content findOneOrCreate(PropelPDO $con = null) Return the first Content matching the query, or a new Content object populated from the query conditions when no match is found
      83:  *
      84:  * @method Content findOneByVisible(int $visible) Return the first Content filtered by the visible column
      85:  * @method Content findOneByPosition(int $position) Return the first Content filtered by the position column
      86:  * @method Content findOneByCreatedAt(string $created_at) Return the first Content filtered by the created_at column
      87:  * @method Content findOneByUpdatedAt(string $updated_at) Return the first Content filtered by the updated_at column
      88:  * @method Content findOneByVersion(int $version) Return the first Content filtered by the version column
      89:  * @method Content findOneByVersionCreatedAt(string $version_created_at) Return the first Content filtered by the version_created_at column
      90:  * @method Content findOneByVersionCreatedBy(string $version_created_by) Return the first Content filtered by the version_created_by column
      91:  *
      92:  * @method array findById(int $id) Return Content objects filtered by the id column
      93:  * @method array findByVisible(int $visible) Return Content objects filtered by the visible column
      94:  * @method array findByPosition(int $position) Return Content objects filtered by the position column
      95:  * @method array findByCreatedAt(string $created_at) Return Content objects filtered by the created_at column
      96:  * @method array findByUpdatedAt(string $updated_at) Return Content objects filtered by the updated_at column
      97:  * @method array findByVersion(int $version) Return Content objects filtered by the version column
      98:  * @method array findByVersionCreatedAt(string $version_created_at) Return Content objects filtered by the version_created_at column
      99:  * @method array findByVersionCreatedBy(string $version_created_by) Return Content objects filtered by the version_created_by column
     100:  *
     101:  * @package    propel.generator.Thelia.Model.om
     102:  */
     103: abstract class BaseContentQuery extends ModelCriteria
     104: {
     105:     /**
     106:      * Initializes internal state of BaseContentQuery object.
     107:      *
     108:      * @param     string $dbName The dabase name
     109:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     110:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     111:      */
     112:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Content', $modelAlias = null)
     113:     {
     114:         parent::__construct($dbName, $modelName, $modelAlias);
     115:     }
     116:
     117:     /**
     118:      * Returns a new ContentQuery object.
     119:      *
     120:      * @param     string $modelAlias The alias of a model in the query
     121:      * @param   ContentQuery|Criteria $criteria Optional Criteria to build the query from
     122:      *
     123:      * @return ContentQuery
     124:      */
     125:     public static function create($modelAlias = null, $criteria = null)
     126:     {
     127:         if ($criteria instanceof ContentQuery) {
     128:             return $criteria;
     129:         }
     130:         $query = new ContentQuery();
     131:         if (null !== $modelAlias) {
     132:             $query->setModelAlias($modelAlias);
     133:         }
     134:         if ($criteria instanceof Criteria) {
     135:             $query->mergeWith($criteria);
     136:         }
     137:
     138:         return $query;
     139:     }
     140:
     141:     /**
     142:      * Find object by primary key.
     143:      * Propel uses the instance pool to skip the database if the object exists.
     144:      * Go fast if the query is untouched.
     145:      *
     146:      * <code>
     147:      * $obj  = $c->findPk(12, $con);
     148:      * </code>
     149:      *
     150:      * @param mixed $key Primary key to use for the query
     151:      * @param     PropelPDO $con an optional connection object
     152:      *
     153:      * @return   Content|Content[]|mixed the result, formatted by the current formatter
     154:      */
     155:     public function findPk($key, $con = null)
     156:     {
     157:         if ($key === null) {
     158:             return null;
     159:         }
     160:         if ((null !== ($obj = ContentPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
     161:             // the object is alredy in the instance pool
     162:             return $obj;
     163:         }
     164:         if ($con === null) {
     165:             $con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     166:         }
     167:         $this->basePreSelect($con);
     168:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
     169:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
     170:          || $this->map || $this->having || $this->joins) {
     171:             return $this->findPkComplex($key, $con);
     172:         } else {
     173:             return $this->findPkSimple($key, $con);
     174:         }
     175:     }
     176:
     177:     /**
     178:      * Alias of findPk to use instance pooling
     179:      *
     180:      * @param     mixed $key Primary key to use for the query
     181:      * @param     PropelPDO $con A connection object
     182:      *
     183:      * @return                 Content A model object, or null if the key is not found
     184:      * @throws PropelException
     185:      */
     186:      public function findOneById($key, $con = null)
     187:      {
     188:         return $this->findPk($key, $con);
     189:      }
     190:
     191:     /**
     192:      * Find object by primary key using raw SQL to go fast.
     193:      * Bypass doSelect() and the object formatter by using generated code.
     194:      *
     195:      * @param     mixed $key Primary key to use for the query
     196:      * @param     PropelPDO $con A connection object
     197:      *
     198:      * @return                 Content A model object, or null if the key is not found
     199:      * @throws PropelException
     200:      */
     201:     protected function findPkSimple($key, $con)
     202:     {
     203:         $sql = 'SELECT `id`, `visible`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `content` WHERE `id` = :p0';
     204:         try {
     205:             $stmt = $con->prepare($sql);
     206:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
     207:             $stmt->execute();
     208:         } catch (Exception $e) {
     209:             Propel::log($e->getMessage(), Propel::LOG_ERR);
     210:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     211:         }
     212:         $obj = null;
     213:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     214:             $obj = new Content();
     215:             $obj->hydrate($row);
     216:             ContentPeer::addInstanceToPool($obj, (string) $key);
     217:         }
     218:         $stmt->closeCursor();
     219:
     220:         return $obj;
     221:     }
     222:
     223:     /**
     224:      * Find object by primary key.
     225:      *
     226:      * @param     mixed $key Primary key to use for the query
     227:      * @param     PropelPDO $con A connection object
     228:      *
     229:      * @return Content|Content[]|mixed the result, formatted by the current formatter
     230:      */
     231:     protected function findPkComplex($key, $con)
     232:     {
     233:         // As the query uses a PK condition, no limit(1) is necessary.
     234:         $criteria = $this->isKeepQuery() ? clone $this : $this;
     235:         $stmt = $criteria
     236:             ->filterByPrimaryKey($key)
     237:             ->doSelect($con);
     238:
     239:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
     240:     }
     241:
     242:     /**
     243:      * Find objects by primary key
     244:      * <code>
     245:      * $objs = $c->findPks(array(12, 56, 832), $con);
     246:      * </code>
     247:      * @param     array $keys Primary keys to use for the query
     248:      * @param     PropelPDO $con an optional connection object
     249:      *
     250:      * @return PropelObjectCollection|Content[]|mixed the list of results, formatted by the current formatter
     251:      */
     252:     public function findPks($keys, $con = null)
     253:     {
     254:         if ($con === null) {
     255:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
     256:         }
     257:         $this->basePreSelect($con);
     258:         $criteria = $this->isKeepQuery() ? clone $this : $this;
     259:         $stmt = $criteria
     260:             ->filterByPrimaryKeys($keys)
     261:             ->doSelect($con);
     262:
     263:         return $criteria->getFormatter()->init($criteria)->format($stmt);
     264:     }
     265:
     266:     /**
     267:      * Filter the query by primary key
     268:      *
     269:      * @param     mixed $key Primary key to use for the query
     270:      *
     271:      * @return ContentQuery The current query, for fluid interface
     272:      */
     273:     public function filterByPrimaryKey($key)
     274:     {
     275:
     276:         return $this->addUsingAlias(ContentPeer::ID, $key, Criteria::EQUAL);
     277:     }
     278:
     279:     /**
     280:      * Filter the query by a list of primary keys
     281:      *
     282:      * @param     array $keys The list of primary key to use for the query
     283:      *
     284:      * @return ContentQuery The current query, for fluid interface
     285:      */
     286:     public function filterByPrimaryKeys($keys)
     287:     {
     288:
     289:         return $this->addUsingAlias(ContentPeer::ID, $keys, Criteria::IN);
     290:     }
     291:
     292:     /**
     293:      * Filter the query on the id column
     294:      *
     295:      * Example usage:
     296:      * <code>
     297:      * $query->filterById(1234); // WHERE id = 1234
     298:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     299:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
     300:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
     301:      * </code>
     302:      *
     303:      * @param     mixed $id The value to use as filter.
     304:      *              Use scalar values for equality.
     305:      *              Use array values for in_array() equivalent.
     306:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     307:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     308:      *
     309:      * @return ContentQuery The current query, for fluid interface
     310:      */
     311:     public function filterById($id = null, $comparison = null)
     312:     {
     313:         if (is_array($id)) {
     314:             $useMinMax = false;
     315:             if (isset($id['min'])) {
     316:                 $this->addUsingAlias(ContentPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
     317:                 $useMinMax = true;
     318:             }
     319:             if (isset($id['max'])) {
     320:                 $this->addUsingAlias(ContentPeer::ID, $id['max'], Criteria::LESS_EQUAL);
     321:                 $useMinMax = true;
     322:             }
     323:             if ($useMinMax) {
     324:                 return $this;
     325:             }
     326:             if (null === $comparison) {
     327:                 $comparison = Criteria::IN;
     328:             }
     329:         }
     330:
     331:         return $this->addUsingAlias(ContentPeer::ID, $id, $comparison);
     332:     }
     333:
     334:     /**
     335:      * Filter the query on the visible column
     336:      *
     337:      * Example usage:
     338:      * <code>
     339:      * $query->filterByVisible(1234); // WHERE visible = 1234
     340:      * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
     341:      * $query->filterByVisible(array('min' => 12)); // WHERE visible >= 12
     342:      * $query->filterByVisible(array('max' => 12)); // WHERE visible <= 12
     343:      * </code>
     344:      *
     345:      * @param     mixed $visible The value to use as filter.
     346:      *              Use scalar values for equality.
     347:      *              Use array values for in_array() equivalent.
     348:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     349:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     350:      *
     351:      * @return ContentQuery The current query, for fluid interface
     352:      */
     353:     public function filterByVisible($visible = null, $comparison = null)
     354:     {
     355:         if (is_array($visible)) {
     356:             $useMinMax = false;
     357:             if (isset($visible['min'])) {
     358:                 $this->addUsingAlias(ContentPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
     359:                 $useMinMax = true;
     360:             }
     361:             if (isset($visible['max'])) {
     362:                 $this->addUsingAlias(ContentPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
     363:                 $useMinMax = true;
     364:             }
     365:             if ($useMinMax) {
     366:                 return $this;
     367:             }
     368:             if (null === $comparison) {
     369:                 $comparison = Criteria::IN;
     370:             }
     371:         }
     372:
     373:         return $this->addUsingAlias(ContentPeer::VISIBLE, $visible, $comparison);
     374:     }
     375:
     376:     /**
     377:      * Filter the query on the position column
     378:      *
     379:      * Example usage:
     380:      * <code>
     381:      * $query->filterByPosition(1234); // WHERE position = 1234
     382:      * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
     383:      * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
     384:      * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
     385:      * </code>
     386:      *
     387:      * @param     mixed $position The value to use as filter.
     388:      *              Use scalar values for equality.
     389:      *              Use array values for in_array() equivalent.
     390:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     391:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     392:      *
     393:      * @return ContentQuery The current query, for fluid interface
     394:      */
     395:     public function filterByPosition($position = null, $comparison = null)
     396:     {
     397:         if (is_array($position)) {
     398:             $useMinMax = false;
     399:             if (isset($position['min'])) {
     400:                 $this->addUsingAlias(ContentPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
     401:                 $useMinMax = true;
     402:             }
     403:             if (isset($position['max'])) {
     404:                 $this->addUsingAlias(ContentPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
     405:                 $useMinMax = true;
     406:             }
     407:             if ($useMinMax) {
     408:                 return $this;
     409:             }
     410:             if (null === $comparison) {
     411:                 $comparison = Criteria::IN;
     412:             }
     413:         }
     414:
     415:         return $this->addUsingAlias(ContentPeer::POSITION, $position, $comparison);
     416:     }
     417:
     418:     /**
     419:      * Filter the query on the created_at column
     420:      *
     421:      * Example usage:
     422:      * <code>
     423:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
     424:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
     425:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
     426:      * </code>
     427:      *
     428:      * @param     mixed $createdAt The value to use as filter.
     429:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
     430:      *              Empty strings are treated as NULL.
     431:      *              Use scalar values for equality.
     432:      *              Use array values for in_array() equivalent.
     433:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     434:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     435:      *
     436:      * @return ContentQuery The current query, for fluid interface
     437:      */
     438:     public function filterByCreatedAt($createdAt = null, $comparison = null)
     439:     {
     440:         if (is_array($createdAt)) {
     441:             $useMinMax = false;
     442:             if (isset($createdAt['min'])) {
     443:                 $this->addUsingAlias(ContentPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
     444:                 $useMinMax = true;
     445:             }
     446:             if (isset($createdAt['max'])) {
     447:                 $this->addUsingAlias(ContentPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
     448:                 $useMinMax = true;
     449:             }
     450:             if ($useMinMax) {
     451:                 return $this;
     452:             }
     453:             if (null === $comparison) {
     454:                 $comparison = Criteria::IN;
     455:             }
     456:         }
     457:
     458:         return $this->addUsingAlias(ContentPeer::CREATED_AT, $createdAt, $comparison);
     459:     }
     460:
     461:     /**
     462:      * Filter the query on the updated_at column
     463:      *
     464:      * Example usage:
     465:      * <code>
     466:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
     467:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
     468:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
     469:      * </code>
     470:      *
     471:      * @param     mixed $updatedAt The value to use as filter.
     472:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
     473:      *              Empty strings are treated as NULL.
     474:      *              Use scalar values for equality.
     475:      *              Use array values for in_array() equivalent.
     476:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     477:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     478:      *
     479:      * @return ContentQuery The current query, for fluid interface
     480:      */
     481:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
     482:     {
     483:         if (is_array($updatedAt)) {
     484:             $useMinMax = false;
     485:             if (isset($updatedAt['min'])) {
     486:                 $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
     487:                 $useMinMax = true;
     488:             }
     489:             if (isset($updatedAt['max'])) {
     490:                 $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
     491:                 $useMinMax = true;
     492:             }
     493:             if ($useMinMax) {
     494:                 return $this;
     495:             }
     496:             if (null === $comparison) {
     497:                 $comparison = Criteria::IN;
     498:             }
     499:         }
     500:
     501:         return $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt, $comparison);
     502:     }
     503:
     504:     /**
     505:      * Filter the query on the version column
     506:      *
     507:      * Example usage:
     508:      * <code>
     509:      * $query->filterByVersion(1234); // WHERE version = 1234
     510:      * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
     511:      * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12
     512:      * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12
     513:      * </code>
     514:      *
     515:      * @param     mixed $version The value to use as filter.
     516:      *              Use scalar values for equality.
     517:      *              Use array values for in_array() equivalent.
     518:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     519:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     520:      *
     521:      * @return ContentQuery The current query, for fluid interface
     522:      */
     523:     public function filterByVersion($version = null, $comparison = null)
     524:     {
     525:         if (is_array($version)) {
     526:             $useMinMax = false;
     527:             if (isset($version['min'])) {
     528:                 $this->addUsingAlias(ContentPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
     529:                 $useMinMax = true;
     530:             }
     531:             if (isset($version['max'])) {
     532:                 $this->addUsingAlias(ContentPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
     533:                 $useMinMax = true;
     534:             }
     535:             if ($useMinMax) {
     536:                 return $this;
     537:             }
     538:             if (null === $comparison) {
     539:                 $comparison = Criteria::IN;
     540:             }
     541:         }
     542:
     543:         return $this->addUsingAlias(ContentPeer::VERSION, $version, $comparison);
     544:     }
     545:
     546:     /**
     547:      * Filter the query on the version_created_at column
     548:      *
     549:      * Example usage:
     550:      * <code>
     551:      * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
     552:      * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
     553:      * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
     554:      * </code>
     555:      *
     556:      * @param     mixed $versionCreatedAt The value to use as filter.
     557:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
     558:      *              Empty strings are treated as NULL.
     559:      *              Use scalar values for equality.
     560:      *              Use array values for in_array() equivalent.
     561:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     562:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     563:      *
     564:      * @return ContentQuery The current query, for fluid interface
     565:      */
     566:     public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
     567:     {
     568:         if (is_array($versionCreatedAt)) {
     569:             $useMinMax = false;
     570:             if (isset($versionCreatedAt['min'])) {
     571:                 $this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
     572:                 $useMinMax = true;
     573:             }
     574:             if (isset($versionCreatedAt['max'])) {
     575:                 $this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
     576:                 $useMinMax = true;
     577:             }
     578:             if ($useMinMax) {
     579:                 return $this;
     580:             }
     581:             if (null === $comparison) {
     582:                 $comparison = Criteria::IN;
     583:             }
     584:         }
     585:
     586:         return $this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
     587:     }
     588:
     589:     /**
     590:      * Filter the query on the version_created_by column
     591:      *
     592:      * Example usage:
     593:      * <code>
     594:      * $query->filterByVersionCreatedBy('fooValue');   // WHERE version_created_by = 'fooValue'
     595:      * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
     596:      * </code>
     597:      *
     598:      * @param     string $versionCreatedBy The value to use as filter.
     599:      *              Accepts wildcards (* and % trigger a LIKE)
     600:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     601:      *
     602:      * @return ContentQuery The current query, for fluid interface
     603:      */
     604:     public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
     605:     {
     606:         if (null === $comparison) {
     607:             if (is_array($versionCreatedBy)) {
     608:                 $comparison = Criteria::IN;
     609:             } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
     610:                 $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
     611:                 $comparison = Criteria::LIKE;
     612:             }
     613:         }
     614:
     615:         return $this->addUsingAlias(ContentPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
     616:     }
     617:
     618:     /**
     619:      * Filter the query by a related ContentAssoc object
     620:      *
     621:      * @param   ContentAssoc|PropelObjectCollection $contentAssoc  the related object to use as filter
     622:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     623:      *
     624:      * @return                 ContentQuery The current query, for fluid interface
     625:      * @throws PropelException - if the provided filter is invalid.
     626:      */
     627:     public function filterByContentAssoc($contentAssoc, $comparison = null)
     628:     {
     629:         if ($contentAssoc instanceof ContentAssoc) {
     630:             return $this
     631:                 ->addUsingAlias(ContentPeer::ID, $contentAssoc->getContentId(), $comparison);
     632:         } elseif ($contentAssoc instanceof PropelObjectCollection) {
     633:             return $this
     634:                 ->useContentAssocQuery()
     635:                 ->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
     636:                 ->endUse();
     637:         } else {
     638:             throw new PropelException('filterByContentAssoc() only accepts arguments of type ContentAssoc or PropelCollection');
     639:         }
     640:     }
     641:
     642:     /**
     643:      * Adds a JOIN clause to the query using the ContentAssoc relation
     644:      *
     645:      * @param     string $relationAlias optional alias for the relation
     646:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     647:      *
     648:      * @return ContentQuery The current query, for fluid interface
     649:      */
     650:     public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     651:     {
     652:         $tableMap = $this->getTableMap();
     653:         $relationMap = $tableMap->getRelation('ContentAssoc');
     654:
     655:         // create a ModelJoin object for this join
     656:         $join = new ModelJoin();
     657:         $join->setJoinType($joinType);
     658:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
     659:         if ($previousJoin = $this->getPreviousJoin()) {
     660:             $join->setPreviousJoin($previousJoin);
     661:         }
     662:
     663:         // add the ModelJoin to the current object
     664:         if ($relationAlias) {
     665:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
     666:             $this->addJoinObject($join, $relationAlias);
     667:         } else {
     668:             $this->addJoinObject($join, 'ContentAssoc');
     669:         }
     670:
     671:         return $this;
     672:     }
     673:
     674:     /**
     675:      * Use the ContentAssoc relation ContentAssoc object
     676:      *
     677:      * @see       useQuery()
     678:      *
     679:      * @param     string $relationAlias optional alias for the relation,
     680:      *                                   to be used as main alias in the secondary query
     681:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     682:      *
     683:      * @return   \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query
     684:      */
     685:     public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     686:     {
     687:         return $this
     688:             ->joinContentAssoc($relationAlias, $joinType)
     689:             ->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
     690:     }
     691:
     692:     /**
     693:      * Filter the query by a related Image object
     694:      *
     695:      * @param   Image|PropelObjectCollection $image  the related object to use as filter
     696:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     697:      *
     698:      * @return                 ContentQuery The current query, for fluid interface
     699:      * @throws PropelException - if the provided filter is invalid.
     700:      */
     701:     public function filterByImage($image, $comparison = null)
     702:     {
     703:         if ($image instanceof Image) {
     704:             return $this
     705:                 ->addUsingAlias(ContentPeer::ID, $image->getContentId(), $comparison);
     706:         } elseif ($image instanceof PropelObjectCollection) {
     707:             return $this
     708:                 ->useImageQuery()
     709:                 ->filterByPrimaryKeys($image->getPrimaryKeys())
     710:                 ->endUse();
     711:         } else {
     712:             throw new PropelException('filterByImage() only accepts arguments of type Image or PropelCollection');
     713:         }
     714:     }
     715:
     716:     /**
     717:      * Adds a JOIN clause to the query using the Image relation
     718:      *
     719:      * @param     string $relationAlias optional alias for the relation
     720:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     721:      *
     722:      * @return ContentQuery The current query, for fluid interface
     723:      */
     724:     public function joinImage($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     725:     {
     726:         $tableMap = $this->getTableMap();
     727:         $relationMap = $tableMap->getRelation('Image');
     728:
     729:         // create a ModelJoin object for this join
     730:         $join = new ModelJoin();
     731:         $join->setJoinType($joinType);
     732:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
     733:         if ($previousJoin = $this->getPreviousJoin()) {
     734:             $join->setPreviousJoin($previousJoin);
     735:         }
     736:
     737:         // add the ModelJoin to the current object
     738:         if ($relationAlias) {
     739:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
     740:             $this->addJoinObject($join, $relationAlias);
     741:         } else {
     742:             $this->addJoinObject($join, 'Image');
     743:         }
     744:
     745:         return $this;
     746:     }
     747:
     748:     /**
     749:      * Use the Image relation Image object
     750:      *
     751:      * @see       useQuery()
     752:      *
     753:      * @param     string $relationAlias optional alias for the relation,
     754:      *                                   to be used as main alias in the secondary query
     755:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     756:      *
     757:      * @return   \Thelia\Model\ImageQuery A secondary query class using the current class as primary query
     758:      */
     759:     public function useImageQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     760:     {
     761:         return $this
     762:             ->joinImage($relationAlias, $joinType)
     763:             ->useQuery($relationAlias ? $relationAlias : 'Image', '\Thelia\Model\ImageQuery');
     764:     }
     765:
     766:     /**
     767:      * Filter the query by a related Document object
     768:      *
     769:      * @param   Document|PropelObjectCollection $document  the related object to use as filter
     770:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     771:      *
     772:      * @return                 ContentQuery The current query, for fluid interface
     773:      * @throws PropelException - if the provided filter is invalid.
     774:      */
     775:     public function filterByDocument($document, $comparison = null)
     776:     {
     777:         if ($document instanceof Document) {
     778:             return $this
     779:                 ->addUsingAlias(ContentPeer::ID, $document->getContentId(), $comparison);
     780:         } elseif ($document instanceof PropelObjectCollection) {
     781:             return $this
     782:                 ->useDocumentQuery()
     783:                 ->filterByPrimaryKeys($document->getPrimaryKeys())
     784:                 ->endUse();
     785:         } else {
     786:             throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection');
     787:         }
     788:     }
     789:
     790:     /**
     791:      * Adds a JOIN clause to the query using the Document relation
     792:      *
     793:      * @param     string $relationAlias optional alias for the relation
     794:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     795:      *
     796:      * @return ContentQuery The current query, for fluid interface
     797:      */
     798:     public function joinDocument($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     799:     {
     800:         $tableMap = $this->getTableMap();
     801:         $relationMap = $tableMap->getRelation('Document');
     802:
     803:         // create a ModelJoin object for this join
     804:         $join = new ModelJoin();
     805:         $join->setJoinType($joinType);
     806:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
     807:         if ($previousJoin = $this->getPreviousJoin()) {
     808:             $join->setPreviousJoin($previousJoin);
     809:         }
     810:
     811:         // add the ModelJoin to the current object
     812:         if ($relationAlias) {
     813:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
     814:             $this->addJoinObject($join, $relationAlias);
     815:         } else {
     816:             $this->addJoinObject($join, 'Document');
     817:         }
     818:
     819:         return $this;
     820:     }
     821:
     822:     /**
     823:      * Use the Document relation Document object
     824:      *
     825:      * @see       useQuery()
     826:      *
     827:      * @param     string $relationAlias optional alias for the relation,
     828:      *                                   to be used as main alias in the secondary query
     829:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     830:      *
     831:      * @return   \Thelia\Model\DocumentQuery A secondary query class using the current class as primary query
     832:      */
     833:     public function useDocumentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     834:     {
     835:         return $this
     836:             ->joinDocument($relationAlias, $joinType)
     837:             ->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery');
     838:     }
     839:
     840:     /**
     841:      * Filter the query by a related Rewriting object
     842:      *
     843:      * @param   Rewriting|PropelObjectCollection $rewriting  the related object to use as filter
     844:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     845:      *
     846:      * @return                 ContentQuery The current query, for fluid interface
     847:      * @throws PropelException - if the provided filter is invalid.
     848:      */
     849:     public function filterByRewriting($rewriting, $comparison = null)
     850:     {
     851:         if ($rewriting instanceof Rewriting) {
     852:             return $this
     853:                 ->addUsingAlias(ContentPeer::ID, $rewriting->getContentId(), $comparison);
     854:         } elseif ($rewriting instanceof PropelObjectCollection) {
     855:             return $this
     856:                 ->useRewritingQuery()
     857:                 ->filterByPrimaryKeys($rewriting->getPrimaryKeys())
     858:                 ->endUse();
     859:         } else {
     860:             throw new PropelException('filterByRewriting() only accepts arguments of type Rewriting or PropelCollection');
     861:         }
     862:     }
     863:
     864:     /**
     865:      * Adds a JOIN clause to the query using the Rewriting relation
     866:      *
     867:      * @param     string $relationAlias optional alias for the relation
     868:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     869:      *
     870:      * @return ContentQuery The current query, for fluid interface
     871:      */
     872:     public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     873:     {
     874:         $tableMap = $this->getTableMap();
     875:         $relationMap = $tableMap->getRelation('Rewriting');
     876:
     877:         // create a ModelJoin object for this join
     878:         $join = new ModelJoin();
     879:         $join->setJoinType($joinType);
     880:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
     881:         if ($previousJoin = $this->getPreviousJoin()) {
     882:             $join->setPreviousJoin($previousJoin);
     883:         }
     884:
     885:         // add the ModelJoin to the current object
     886:         if ($relationAlias) {
     887:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
     888:             $this->addJoinObject($join, $relationAlias);
     889:         } else {
     890:             $this->addJoinObject($join, 'Rewriting');
     891:         }
     892:
     893:         return $this;
     894:     }
     895:
     896:     /**
     897:      * Use the Rewriting relation Rewriting object
     898:      *
     899:      * @see       useQuery()
     900:      *
     901:      * @param     string $relationAlias optional alias for the relation,
     902:      *                                   to be used as main alias in the secondary query
     903:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     904:      *
     905:      * @return   \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query
     906:      */
     907:     public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
     908:     {
     909:         return $this
     910:             ->joinRewriting($relationAlias, $joinType)
     911:             ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery');
     912:     }
     913:
     914:     /**
     915:      * Filter the query by a related ContentFolder object
     916:      *
     917:      * @param   ContentFolder|PropelObjectCollection $contentFolder  the related object to use as filter
     918:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     919:      *
     920:      * @return                 ContentQuery The current query, for fluid interface
     921:      * @throws PropelException - if the provided filter is invalid.
     922:      */
     923:     public function filterByContentFolder($contentFolder, $comparison = null)
     924:     {
     925:         if ($contentFolder instanceof ContentFolder) {
     926:             return $this
     927:                 ->addUsingAlias(ContentPeer::ID, $contentFolder->getContentId(), $comparison);
     928:         } elseif ($contentFolder instanceof PropelObjectCollection) {
     929:             return $this
     930:                 ->useContentFolderQuery()
     931:                 ->filterByPrimaryKeys($contentFolder->getPrimaryKeys())
     932:                 ->endUse();
     933:         } else {
     934:             throw new PropelException('filterByContentFolder() only accepts arguments of type ContentFolder or PropelCollection');
     935:         }
     936:     }
     937:
     938:     /**
     939:      * Adds a JOIN clause to the query using the ContentFolder relation
     940:      *
     941:      * @param     string $relationAlias optional alias for the relation
     942:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     943:      *
     944:      * @return ContentQuery The current query, for fluid interface
     945:      */
     946:     public function joinContentFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
     947:     {
     948:         $tableMap = $this->getTableMap();
     949:         $relationMap = $tableMap->getRelation('ContentFolder');
     950:
     951:         // create a ModelJoin object for this join
     952:         $join = new ModelJoin();
     953:         $join->setJoinType($joinType);
     954:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
     955:         if ($previousJoin = $this->getPreviousJoin()) {
     956:             $join->setPreviousJoin($previousJoin);
     957:         }
     958:
     959:         // add the ModelJoin to the current object
     960:         if ($relationAlias) {
     961:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
     962:             $this->addJoinObject($join, $relationAlias);
     963:         } else {
     964:             $this->addJoinObject($join, 'ContentFolder');
     965:         }
     966:
     967:         return $this;
     968:     }
     969:
     970:     /**
     971:      * Use the ContentFolder relation ContentFolder object
     972:      *
     973:      * @see       useQuery()
     974:      *
     975:      * @param     string $relationAlias optional alias for the relation,
     976:      *                                   to be used as main alias in the secondary query
     977:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     978:      *
     979:      * @return   \Thelia\Model\ContentFolderQuery A secondary query class using the current class as primary query
     980:      */
     981:     public function useContentFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
     982:     {
     983:         return $this
     984:             ->joinContentFolder($relationAlias, $joinType)
     985:             ->useQuery($relationAlias ? $relationAlias : 'ContentFolder', '\Thelia\Model\ContentFolderQuery');
     986:     }
     987:
     988:     /**
     989:      * Filter the query by a related ContentI18n object
     990:      *
     991:      * @param   ContentI18n|PropelObjectCollection $contentI18n  the related object to use as filter
     992:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     993:      *
     994:      * @return                 ContentQuery The current query, for fluid interface
     995:      * @throws PropelException - if the provided filter is invalid.
     996:      */
     997:     public function filterByContentI18n($contentI18n, $comparison = null)
     998:     {
     999:         if ($contentI18n instanceof ContentI18n) {
    1000:             return $this
    1001:                 ->addUsingAlias(ContentPeer::ID, $contentI18n->getId(), $comparison);
    1002:         } elseif ($contentI18n instanceof PropelObjectCollection) {
    1003:             return $this
    1004:                 ->useContentI18nQuery()
    1005:                 ->filterByPrimaryKeys($contentI18n->getPrimaryKeys())
    1006:                 ->endUse();
    1007:         } else {
    1008:             throw new PropelException('filterByContentI18n() only accepts arguments of type ContentI18n or PropelCollection');
    1009:         }
    1010:     }
    1011:
    1012:     /**
    1013:      * Adds a JOIN clause to the query using the ContentI18n relation
    1014:      *
    1015:      * @param     string $relationAlias optional alias for the relation
    1016:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1017:      *
    1018:      * @return ContentQuery The current query, for fluid interface
    1019:      */
    1020:     public function joinContentI18n($relationAlias = null, $joinType = 'LEFT JOIN')
    1021:     {
    1022:         $tableMap = $this->getTableMap();
    1023:         $relationMap = $tableMap->getRelation('ContentI18n');
    1024:
    1025:         // create a ModelJoin object for this join
    1026:         $join = new ModelJoin();
    1027:         $join->setJoinType($joinType);
    1028:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    1029:         if ($previousJoin = $this->getPreviousJoin()) {
    1030:             $join->setPreviousJoin($previousJoin);
    1031:         }
    1032:
    1033:         // add the ModelJoin to the current object
    1034:         if ($relationAlias) {
    1035:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    1036:             $this->addJoinObject($join, $relationAlias);
    1037:         } else {
    1038:             $this->addJoinObject($join, 'ContentI18n');
    1039:         }
    1040:
    1041:         return $this;
    1042:     }
    1043:
    1044:     /**
    1045:      * Use the ContentI18n relation ContentI18n object
    1046:      *
    1047:      * @see       useQuery()
    1048:      *
    1049:      * @param     string $relationAlias optional alias for the relation,
    1050:      *                                   to be used as main alias in the secondary query
    1051:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1052:      *
    1053:      * @return   \Thelia\Model\ContentI18nQuery A secondary query class using the current class as primary query
    1054:      */
    1055:     public function useContentI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
    1056:     {
    1057:         return $this
    1058:             ->joinContentI18n($relationAlias, $joinType)
    1059:             ->useQuery($relationAlias ? $relationAlias : 'ContentI18n', '\Thelia\Model\ContentI18nQuery');
    1060:     }
    1061:
    1062:     /**
    1063:      * Filter the query by a related ContentVersion object
    1064:      *
    1065:      * @param   ContentVersion|PropelObjectCollection $contentVersion  the related object to use as filter
    1066:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1067:      *
    1068:      * @return                 ContentQuery The current query, for fluid interface
    1069:      * @throws PropelException - if the provided filter is invalid.
    1070:      */
    1071:     public function filterByContentVersion($contentVersion, $comparison = null)
    1072:     {
    1073:         if ($contentVersion instanceof ContentVersion) {
    1074:             return $this
    1075:                 ->addUsingAlias(ContentPeer::ID, $contentVersion->getId(), $comparison);
    1076:         } elseif ($contentVersion instanceof PropelObjectCollection) {
    1077:             return $this
    1078:                 ->useContentVersionQuery()
    1079:                 ->filterByPrimaryKeys($contentVersion->getPrimaryKeys())
    1080:                 ->endUse();
    1081:         } else {
    1082:             throw new PropelException('filterByContentVersion() only accepts arguments of type ContentVersion or PropelCollection');
    1083:         }
    1084:     }
    1085:
    1086:     /**
    1087:      * Adds a JOIN clause to the query using the ContentVersion relation
    1088:      *
    1089:      * @param     string $relationAlias optional alias for the relation
    1090:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1091:      *
    1092:      * @return ContentQuery The current query, for fluid interface
    1093:      */
    1094:     public function joinContentVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1095:     {
    1096:         $tableMap = $this->getTableMap();
    1097:         $relationMap = $tableMap->getRelation('ContentVersion');
    1098:
    1099:         // create a ModelJoin object for this join
    1100:         $join = new ModelJoin();
    1101:         $join->setJoinType($joinType);
    1102:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    1103:         if ($previousJoin = $this->getPreviousJoin()) {
    1104:             $join->setPreviousJoin($previousJoin);
    1105:         }
    1106:
    1107:         // add the ModelJoin to the current object
    1108:         if ($relationAlias) {
    1109:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    1110:             $this->addJoinObject($join, $relationAlias);
    1111:         } else {
    1112:             $this->addJoinObject($join, 'ContentVersion');
    1113:         }
    1114:
    1115:         return $this;
    1116:     }
    1117:
    1118:     /**
    1119:      * Use the ContentVersion relation ContentVersion object
    1120:      *
    1121:      * @see       useQuery()
    1122:      *
    1123:      * @param     string $relationAlias optional alias for the relation,
    1124:      *                                   to be used as main alias in the secondary query
    1125:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1126:      *
    1127:      * @return   \Thelia\Model\ContentVersionQuery A secondary query class using the current class as primary query
    1128:      */
    1129:     public function useContentVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1130:     {
    1131:         return $this
    1132:             ->joinContentVersion($relationAlias, $joinType)
    1133:             ->useQuery($relationAlias ? $relationAlias : 'ContentVersion', '\Thelia\Model\ContentVersionQuery');
    1134:     }
    1135:
    1136:     /**
    1137:      * Exclude object from result
    1138:      *
    1139:      * @param   Content $content Object to remove from the list of results
    1140:      *
    1141:      * @return ContentQuery The current query, for fluid interface
    1142:      */
    1143:     public function prune($content = null)
    1144:     {
    1145:         if ($content) {
    1146:             $this->addUsingAlias(ContentPeer::ID, $content->getId(), Criteria::NOT_EQUAL);
    1147:         }
    1148:
    1149:         return $this;
    1150:     }
    1151:
    1152:     // timestampable behavior
    1153:
    1154:     /**
    1155:      * Filter by the latest updated
    1156:      *
    1157:      * @param      int $nbDays Maximum age of the latest update in days
    1158:      *
    1159:      * @return     ContentQuery The current query, for fluid interface
    1160:      */
    1161:     public function recentlyUpdated($nbDays = 7)
    1162:     {
    1163:         return $this->addUsingAlias(ContentPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    1164:     }
    1165:
    1166:     /**
    1167:      * Order by update date desc
    1168:      *
    1169:      * @return     ContentQuery The current query, for fluid interface
    1170:      */
    1171:     public function lastUpdatedFirst()
    1172:     {
    1173:         return $this->addDescendingOrderByColumn(ContentPeer::UPDATED_AT);
    1174:     }
    1175:
    1176:     /**
    1177:      * Order by update date asc
    1178:      *
    1179:      * @return     ContentQuery The current query, for fluid interface
    1180:      */
    1181:     public function firstUpdatedFirst()
    1182:     {
    1183:         return $this->addAscendingOrderByColumn(ContentPeer::UPDATED_AT);
    1184:     }
    1185:
    1186:     /**
    1187:      * Filter by the latest created
    1188:      *
    1189:      * @param      int $nbDays Maximum age of in days
    1190:      *
    1191:      * @return     ContentQuery The current query, for fluid interface
    1192:      */
    1193:     public function recentlyCreated($nbDays = 7)
    1194:     {
    1195:         return $this->addUsingAlias(ContentPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    1196:     }
    1197:
    1198:     /**
    1199:      * Order by create date desc
    1200:      *
    1201:      * @return     ContentQuery The current query, for fluid interface
    1202:      */
    1203:     public function lastCreatedFirst()
    1204:     {
    1205:         return $this->addDescendingOrderByColumn(ContentPeer::CREATED_AT);
    1206:     }
    1207:
    1208:     /**
    1209:      * Order by create date asc
    1210:      *
    1211:      * @return     ContentQuery The current query, for fluid interface
    1212:      */
    1213:     public function firstCreatedFirst()
    1214:     {
    1215:         return $this->addAscendingOrderByColumn(ContentPeer::CREATED_AT);
    1216:     }
    1217:     // i18n behavior
    1218:
    1219:     /**
    1220:      * Adds a JOIN clause to the query using the i18n relation
    1221:      *
    1222:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    1223:      * @param     string $relationAlias optional alias for the relation
    1224:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    1225:      *
    1226:      * @return    ContentQuery The current query, for fluid interface
    1227:      */
    1228:     public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    1229:     {
    1230:         $relationName = $relationAlias ? $relationAlias : 'ContentI18n';
    1231:
    1232:         return $this
    1233:             ->joinContentI18n($relationAlias, $joinType)
    1234:             ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
    1235:     }
    1236:
    1237:     /**
    1238:      * Adds a JOIN clause to the query and hydrates the related I18n object.
    1239:      * Shortcut for $c->joinI18n($locale)->with()
    1240:      *
    1241:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    1242:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    1243:      *
    1244:      * @return    ContentQuery The current query, for fluid interface
    1245:      */
    1246:     public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
    1247:     {
    1248:         $this
    1249:             ->joinI18n($locale, null, $joinType)
    1250:             ->with('ContentI18n');
    1251:         $this->with['ContentI18n']->setIsWithOneToMany(false);
    1252:
    1253:         return $this;
    1254:     }
    1255:
    1256:     /**
    1257:      * Use the I18n relation query object
    1258:      *
    1259:      * @see       useQuery()
    1260:      *
    1261:      * @param     string $locale Locale to use for the join condition, e.g. 'fr_FR'
    1262:      * @param     string $relationAlias optional alias for the relation
    1263:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
    1264:      *
    1265:      * @return    ContentI18nQuery A secondary query class using the current class as primary query
    1266:      */
    1267:     public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    1268:     {
    1269:         return $this
    1270:             ->joinI18n($locale, $relationAlias, $joinType)
    1271:             ->useQuery($relationAlias ? $relationAlias : 'ContentI18n', 'Thelia\Model\ContentI18nQuery');
    1272:     }
    1273:
    1274: }
    1275: