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