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