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