# File core/lib/Thelia/Model/om/BaseFolderDescQuery.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\Folder;
     16: use Thelia\Model\FolderDesc;
     17: use Thelia\Model\FolderDescPeer;
     18: use Thelia\Model\FolderDescQuery;
     19:
     20: /**
     21:  * Base class that represents a query for the 'folder_desc' table.
     22:  *
     23:  *
     24:  *
     25:  * @method FolderDescQuery orderById($order = Criteria::ASC) Order by the id column
     26:  * @method FolderDescQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column
     27:  * @method FolderDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
     28:  * @method FolderDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
     29:  * @method FolderDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
     30:  * @method FolderDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
     31:  * @method FolderDescQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
     32:  * @method FolderDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     33:  * @method FolderDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     34:  *
     35:  * @method FolderDescQuery groupById() Group by the id column
     36:  * @method FolderDescQuery groupByFolderId() Group by the folder_id column
     37:  * @method FolderDescQuery groupByLang() Group by the lang column
     38:  * @method FolderDescQuery groupByTitle() Group by the title column
     39:  * @method FolderDescQuery groupByDescription() Group by the description column
     40:  * @method FolderDescQuery groupByChapo() Group by the chapo column
     41:  * @method FolderDescQuery groupByPostscriptum() Group by the postscriptum column
     42:  * @method FolderDescQuery groupByCreatedAt() Group by the created_at column
     43:  * @method FolderDescQuery groupByUpdatedAt() Group by the updated_at column
     44:  *
     45:  * @method FolderDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     46:  * @method FolderDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     47:  * @method FolderDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     48:  *
     49:  * @method FolderDescQuery leftJoinFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Folder relation
     50:  * @method FolderDescQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
     51:  * @method FolderDescQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
     52:  *
     53:  * @method FolderDesc findOne(PropelPDO $con = null) Return the first FolderDesc matching the query
     54:  * @method FolderDesc findOneOrCreate(PropelPDO $con = null) Return the first FolderDesc matching the query, or a new FolderDesc object populated from the query conditions when no match is found
     55:  *
     56:  * @method FolderDesc findOneById(int $id) Return the first FolderDesc filtered by the id column
     57:  * @method FolderDesc findOneByFolderId(int $folder_id) Return the first FolderDesc filtered by the folder_id column
     58:  * @method FolderDesc findOneByLang(string $lang) Return the first FolderDesc filtered by the lang column
     59:  * @method FolderDesc findOneByTitle(string $title) Return the first FolderDesc filtered by the title column
     60:  * @method FolderDesc findOneByDescription(string $description) Return the first FolderDesc filtered by the description column
     61:  * @method FolderDesc findOneByChapo(string $chapo) Return the first FolderDesc filtered by the chapo column
     62:  * @method FolderDesc findOneByPostscriptum(string $postscriptum) Return the first FolderDesc filtered by the postscriptum column
     63:  * @method FolderDesc findOneByCreatedAt(string $created_at) Return the first FolderDesc filtered by the created_at column
     64:  * @method FolderDesc findOneByUpdatedAt(string $updated_at) Return the first FolderDesc filtered by the updated_at column
     65:  *
     66:  * @method array findById(int $id) Return FolderDesc objects filtered by the id column
     67:  * @method array findByFolderId(int $folder_id) Return FolderDesc objects filtered by the folder_id column
     68:  * @method array findByLang(string $lang) Return FolderDesc objects filtered by the lang column
     69:  * @method array findByTitle(string $title) Return FolderDesc objects filtered by the title column
     70:  * @method array findByDescription(string $description) Return FolderDesc objects filtered by the description column
     71:  * @method array findByChapo(string $chapo) Return FolderDesc objects filtered by the chapo column
     72:  * @method array findByPostscriptum(string $postscriptum) Return FolderDesc objects filtered by the postscriptum column
     73:  * @method array findByCreatedAt(string $created_at) Return FolderDesc objects filtered by the created_at column
     74:  * @method array findByUpdatedAt(string $updated_at) Return FolderDesc objects filtered by the updated_at column
     75:  *
     76:  * @package    propel.generator.Thelia.Model.om
     77:  */
     78: abstract class BaseFolderDescQuery extends ModelCriteria
     79: {
     80:     /**
     81:      * Initializes internal state of BaseFolderDescQuery object.
     82:      *
     83:      * @param     string $dbName The dabase name
     84:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     85:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     86:      */
     87:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\FolderDesc', $modelAlias = null)
     88:     {
     89:         parent::__construct($dbName, $modelName, $modelAlias);
     90:     }
     91:
     92:     /**
     93:      * Returns a new FolderDescQuery object.
     94:      *
     95:      * @param     string $modelAlias The alias of a model in the query
     96:      * @param     FolderDescQuery|Criteria $criteria Optional Criteria to build the query from
     97:      *
     98:      * @return FolderDescQuery
     99:      */
    100:     public static function create($modelAlias = null, $criteria = null)
    101:     {
    102:         if ($criteria instanceof FolderDescQuery) {
    103:             return $criteria;
    104:         }
    105:         $query = new FolderDescQuery();
    106:         if (null !== $modelAlias) {
    107:             $query->setModelAlias($modelAlias);
    108:         }
    109:         if ($criteria instanceof Criteria) {
    110:             $query->mergeWith($criteria);
    111:         }
    112:
    113:         return $query;
    114:     }
    115:
    116:     /**
    117:      * Find object by primary key.
    118:      * Propel uses the instance pool to skip the database if the object exists.
    119:      * Go fast if the query is untouched.
    120:      *
    121:      * <code>
    122:      * $obj  = $c->findPk(12, $con);
    123:      * </code>
    124:      *
    125:      * @param mixed $key Primary key to use for the query
    126:      * @param     PropelPDO $con an optional connection object
    127:      *
    128:      * @return   FolderDesc|FolderDesc[]|mixed the result, formatted by the current formatter
    129:      */
    130:     public function findPk($key, $con = null)
    131:     {
    132:         if ($key === null) {
    133:             return null;
    134:         }
    135:         if ((null !== ($obj = FolderDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
    136:             // the object is alredy in the instance pool
    137:             return $obj;
    138:         }
    139:         if ($con === null) {
    140:             $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    141:         }
    142:         $this->basePreSelect($con);
    143:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
    144:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
    145:          || $this->map || $this->having || $this->joins) {
    146:             return $this->findPkComplex($key, $con);
    147:         } else {
    148:             return $this->findPkSimple($key, $con);
    149:         }
    150:     }
    151:
    152:     /**
    153:      * Find object by primary key using raw SQL to go fast.
    154:      * Bypass doSelect() and the object formatter by using generated code.
    155:      *
    156:      * @param     mixed $key Primary key to use for the query
    157:      * @param     PropelPDO $con A connection object
    158:      *
    159:      * @return   FolderDesc A model object, or null if the key is not found
    160:      * @throws   PropelException
    161:      */
    162:     protected function findPkSimple($key, $con)
    163:     {
    164:         $sql = 'SELECT `ID`, `FOLDER_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `folder_desc` WHERE `ID` = :p0';
    165:         try {
    166:             $stmt = $con->prepare($sql);
    167:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
    168:             $stmt->execute();
    169:         } catch (Exception $e) {
    170:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    171:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    172:         }
    173:         $obj = null;
    174:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    175:             $obj = new FolderDesc();
    176:             $obj->hydrate($row);
    177:             FolderDescPeer::addInstanceToPool($obj, (string) $key);
    178:         }
    179:         $stmt->closeCursor();
    180:
    181:         return $obj;
    182:     }
    183:
    184:     /**
    185:      * Find object by primary key.
    186:      *
    187:      * @param     mixed $key Primary key to use for the query
    188:      * @param     PropelPDO $con A connection object
    189:      *
    190:      * @return FolderDesc|FolderDesc[]|mixed the result, formatted by the current formatter
    191:      */
    192:     protected function findPkComplex($key, $con)
    193:     {
    194:         // As the query uses a PK condition, no limit(1) is necessary.
    195:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    196:         $stmt = $criteria
    197:             ->filterByPrimaryKey($key)
    198:             ->doSelect($con);
    199:
    200:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    201:     }
    202:
    203:     /**
    204:      * Find objects by primary key
    205:      * <code>
    206:      * $objs = $c->findPks(array(12, 56, 832), $con);
    207:      * </code>
    208:      * @param     array $keys Primary keys to use for the query
    209:      * @param     PropelPDO $con an optional connection object
    210:      *
    211:      * @return PropelObjectCollection|FolderDesc[]|mixed the list of results, formatted by the current formatter
    212:      */
    213:     public function findPks($keys, $con = null)
    214:     {
    215:         if ($con === null) {
    216:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    217:         }
    218:         $this->basePreSelect($con);
    219:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    220:         $stmt = $criteria
    221:             ->filterByPrimaryKeys($keys)
    222:             ->doSelect($con);
    223:
    224:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    225:     }
    226:
    227:     /**
    228:      * Filter the query by primary key
    229:      *
    230:      * @param     mixed $key Primary key to use for the query
    231:      *
    232:      * @return FolderDescQuery The current query, for fluid interface
    233:      */
    234:     public function filterByPrimaryKey($key)
    235:     {
    236:
    237:         return $this->addUsingAlias(FolderDescPeer::ID, $key, Criteria::EQUAL);
    238:     }
    239:
    240:     /**
    241:      * Filter the query by a list of primary keys
    242:      *
    243:      * @param     array $keys The list of primary key to use for the query
    244:      *
    245:      * @return FolderDescQuery The current query, for fluid interface
    246:      */
    247:     public function filterByPrimaryKeys($keys)
    248:     {
    249:
    250:         return $this->addUsingAlias(FolderDescPeer::ID, $keys, Criteria::IN);
    251:     }
    252:
    253:     /**
    254:      * Filter the query on the id column
    255:      *
    256:      * Example usage:
    257:      * <code>
    258:      * $query->filterById(1234); // WHERE id = 1234
    259:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    260:      * $query->filterById(array('min' => 12)); // WHERE id > 12
    261:      * </code>
    262:      *
    263:      * @param     mixed $id The value to use as filter.
    264:      *              Use scalar values for equality.
    265:      *              Use array values for in_array() equivalent.
    266:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    267:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    268:      *
    269:      * @return FolderDescQuery The current query, for fluid interface
    270:      */
    271:     public function filterById($id = null, $comparison = null)
    272:     {
    273:         if (is_array($id) && null === $comparison) {
    274:             $comparison = Criteria::IN;
    275:         }
    276:
    277:         return $this->addUsingAlias(FolderDescPeer::ID, $id, $comparison);
    278:     }
    279:
    280:     /**
    281:      * Filter the query on the folder_id column
    282:      *
    283:      * Example usage:
    284:      * <code>
    285:      * $query->filterByFolderId(1234); // WHERE folder_id = 1234
    286:      * $query->filterByFolderId(array(12, 34)); // WHERE folder_id IN (12, 34)
    287:      * $query->filterByFolderId(array('min' => 12)); // WHERE folder_id > 12
    288:      * </code>
    289:      *
    290:      * @see       filterByFolder()
    291:      *
    292:      * @param     mixed $folderId 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 FolderDescQuery The current query, for fluid interface
    299:      */
    300:     public function filterByFolderId($folderId = null, $comparison = null)
    301:     {
    302:         if (is_array($folderId)) {
    303:             $useMinMax = false;
    304:             if (isset($folderId['min'])) {
    305:                 $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId['min'], Criteria::GREATER_EQUAL);
    306:                 $useMinMax = true;
    307:             }
    308:             if (isset($folderId['max'])) {
    309:                 $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId['max'], Criteria::LESS_EQUAL);
    310:                 $useMinMax = true;
    311:             }
    312:             if ($useMinMax) {
    313:                 return $this;
    314:             }
    315:             if (null === $comparison) {
    316:                 $comparison = Criteria::IN;
    317:             }
    318:         }
    319:
    320:         return $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId, $comparison);
    321:     }
    322:
    323:     /**
    324:      * Filter the query on the lang column
    325:      *
    326:      * Example usage:
    327:      * <code>
    328:      * $query->filterByLang('fooValue');   // WHERE lang = 'fooValue'
    329:      * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
    330:      * </code>
    331:      *
    332:      * @param     string $lang The value to use as filter.
    333:      *              Accepts wildcards (* and % trigger a LIKE)
    334:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    335:      *
    336:      * @return FolderDescQuery The current query, for fluid interface
    337:      */
    338:     public function filterByLang($lang = null, $comparison = null)
    339:     {
    340:         if (null === $comparison) {
    341:             if (is_array($lang)) {
    342:                 $comparison = Criteria::IN;
    343:             } elseif (preg_match('/[\%\*]/', $lang)) {
    344:                 $lang = str_replace('*', '%', $lang);
    345:                 $comparison = Criteria::LIKE;
    346:             }
    347:         }
    348:
    349:         return $this->addUsingAlias(FolderDescPeer::LANG, $lang, $comparison);
    350:     }
    351:
    352:     /**
    353:      * Filter the query on the title column
    354:      *
    355:      * Example usage:
    356:      * <code>
    357:      * $query->filterByTitle('fooValue');   // WHERE title = 'fooValue'
    358:      * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
    359:      * </code>
    360:      *
    361:      * @param     string $title The value to use as filter.
    362:      *              Accepts wildcards (* and % trigger a LIKE)
    363:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    364:      *
    365:      * @return FolderDescQuery The current query, for fluid interface
    366:      */
    367:     public function filterByTitle($title = null, $comparison = null)
    368:     {
    369:         if (null === $comparison) {
    370:             if (is_array($title)) {
    371:                 $comparison = Criteria::IN;
    372:             } elseif (preg_match('/[\%\*]/', $title)) {
    373:                 $title = str_replace('*', '%', $title);
    374:                 $comparison = Criteria::LIKE;
    375:             }
    376:         }
    377:
    378:         return $this->addUsingAlias(FolderDescPeer::TITLE, $title, $comparison);
    379:     }
    380:
    381:     /**
    382:      * Filter the query on the description column
    383:      *
    384:      * Example usage:
    385:      * <code>
    386:      * $query->filterByDescription('fooValue');   // WHERE description = 'fooValue'
    387:      * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
    388:      * </code>
    389:      *
    390:      * @param     string $description The value to use as filter.
    391:      *              Accepts wildcards (* and % trigger a LIKE)
    392:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    393:      *
    394:      * @return FolderDescQuery The current query, for fluid interface
    395:      */
    396:     public function filterByDescription($description = null, $comparison = null)
    397:     {
    398:         if (null === $comparison) {
    399:             if (is_array($description)) {
    400:                 $comparison = Criteria::IN;
    401:             } elseif (preg_match('/[\%\*]/', $description)) {
    402:                 $description = str_replace('*', '%', $description);
    403:                 $comparison = Criteria::LIKE;
    404:             }
    405:         }
    406:
    407:         return $this->addUsingAlias(FolderDescPeer::DESCRIPTION, $description, $comparison);
    408:     }
    409:
    410:     /**
    411:      * Filter the query on the chapo column
    412:      *
    413:      * Example usage:
    414:      * <code>
    415:      * $query->filterByChapo('fooValue');   // WHERE chapo = 'fooValue'
    416:      * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
    417:      * </code>
    418:      *
    419:      * @param     string $chapo The value to use as filter.
    420:      *              Accepts wildcards (* and % trigger a LIKE)
    421:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    422:      *
    423:      * @return FolderDescQuery The current query, for fluid interface
    424:      */
    425:     public function filterByChapo($chapo = null, $comparison = null)
    426:     {
    427:         if (null === $comparison) {
    428:             if (is_array($chapo)) {
    429:                 $comparison = Criteria::IN;
    430:             } elseif (preg_match('/[\%\*]/', $chapo)) {
    431:                 $chapo = str_replace('*', '%', $chapo);
    432:                 $comparison = Criteria::LIKE;
    433:             }
    434:         }
    435:
    436:         return $this->addUsingAlias(FolderDescPeer::CHAPO, $chapo, $comparison);
    437:     }
    438:
    439:     /**
    440:      * Filter the query on the postscriptum column
    441:      *
    442:      * Example usage:
    443:      * <code>
    444:      * $query->filterByPostscriptum('fooValue');   // WHERE postscriptum = 'fooValue'
    445:      * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
    446:      * </code>
    447:      *
    448:      * @param     string $postscriptum The value to use as filter.
    449:      *              Accepts wildcards (* and % trigger a LIKE)
    450:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    451:      *
    452:      * @return FolderDescQuery The current query, for fluid interface
    453:      */
    454:     public function filterByPostscriptum($postscriptum = null, $comparison = null)
    455:     {
    456:         if (null === $comparison) {
    457:             if (is_array($postscriptum)) {
    458:                 $comparison = Criteria::IN;
    459:             } elseif (preg_match('/[\%\*]/', $postscriptum)) {
    460:                 $postscriptum = str_replace('*', '%', $postscriptum);
    461:                 $comparison = Criteria::LIKE;
    462:             }
    463:         }
    464:
    465:         return $this->addUsingAlias(FolderDescPeer::POSTSCRIPTUM, $postscriptum, $comparison);
    466:     }
    467:
    468:     /**
    469:      * Filter the query on the created_at column
    470:      *
    471:      * Example usage:
    472:      * <code>
    473:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    474:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    475:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    476:      * </code>
    477:      *
    478:      * @param     mixed $createdAt The value to use as filter.
    479:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    480:      *              Empty strings are treated as NULL.
    481:      *              Use scalar values for equality.
    482:      *              Use array values for in_array() equivalent.
    483:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    484:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    485:      *
    486:      * @return FolderDescQuery The current query, for fluid interface
    487:      */
    488:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    489:     {
    490:         if (is_array($createdAt)) {
    491:             $useMinMax = false;
    492:             if (isset($createdAt['min'])) {
    493:                 $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    494:                 $useMinMax = true;
    495:             }
    496:             if (isset($createdAt['max'])) {
    497:                 $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    498:                 $useMinMax = true;
    499:             }
    500:             if ($useMinMax) {
    501:                 return $this;
    502:             }
    503:             if (null === $comparison) {
    504:                 $comparison = Criteria::IN;
    505:             }
    506:         }
    507:
    508:         return $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt, $comparison);
    509:     }
    510:
    511:     /**
    512:      * Filter the query on the updated_at column
    513:      *
    514:      * Example usage:
    515:      * <code>
    516:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    517:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    518:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    519:      * </code>
    520:      *
    521:      * @param     mixed $updatedAt The value to use as filter.
    522:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    523:      *              Empty strings are treated as NULL.
    524:      *              Use scalar values for equality.
    525:      *              Use array values for in_array() equivalent.
    526:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    527:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    528:      *
    529:      * @return FolderDescQuery The current query, for fluid interface
    530:      */
    531:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    532:     {
    533:         if (is_array($updatedAt)) {
    534:             $useMinMax = false;
    535:             if (isset($updatedAt['min'])) {
    536:                 $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    537:                 $useMinMax = true;
    538:             }
    539:             if (isset($updatedAt['max'])) {
    540:                 $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    541:                 $useMinMax = true;
    542:             }
    543:             if ($useMinMax) {
    544:                 return $this;
    545:             }
    546:             if (null === $comparison) {
    547:                 $comparison = Criteria::IN;
    548:             }
    549:         }
    550:
    551:         return $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt, $comparison);
    552:     }
    553:
    554:     /**
    555:      * Filter the query by a related Folder object
    556:      *
    557:      * @param   Folder|PropelObjectCollection $folder The related object(s) to use as filter
    558:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    559:      *
    560:      * @return   FolderDescQuery The current query, for fluid interface
    561:      * @throws   PropelException - if the provided filter is invalid.
    562:      */
    563:     public function filterByFolder($folder, $comparison = null)
    564:     {
    565:         if ($folder instanceof Folder) {
    566:             return $this
    567:                 ->addUsingAlias(FolderDescPeer::FOLDER_ID, $folder->getId(), $comparison);
    568:         } elseif ($folder instanceof PropelObjectCollection) {
    569:             if (null === $comparison) {
    570:                 $comparison = Criteria::IN;
    571:             }
    572:
    573:             return $this
    574:                 ->addUsingAlias(FolderDescPeer::FOLDER_ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison);
    575:         } else {
    576:             throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection');
    577:         }
    578:     }
    579:
    580:     /**
    581:      * Adds a JOIN clause to the query using the Folder relation
    582:      *
    583:      * @param     string $relationAlias optional alias for the relation
    584:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    585:      *
    586:      * @return FolderDescQuery The current query, for fluid interface
    587:      */
    588:     public function joinFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    589:     {
    590:         $tableMap = $this->getTableMap();
    591:         $relationMap = $tableMap->getRelation('Folder');
    592:
    593:         // create a ModelJoin object for this join
    594:         $join = new ModelJoin();
    595:         $join->setJoinType($joinType);
    596:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    597:         if ($previousJoin = $this->getPreviousJoin()) {
    598:             $join->setPreviousJoin($previousJoin);
    599:         }
    600:
    601:         // add the ModelJoin to the current object
    602:         if ($relationAlias) {
    603:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    604:             $this->addJoinObject($join, $relationAlias);
    605:         } else {
    606:             $this->addJoinObject($join, 'Folder');
    607:         }
    608:
    609:         return $this;
    610:     }
    611:
    612:     /**
    613:      * Use the Folder relation Folder object
    614:      *
    615:      * @see       useQuery()
    616:      *
    617:      * @param     string $relationAlias optional alias for the relation,
    618:      *                                   to be used as main alias in the secondary query
    619:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    620:      *
    621:      * @return   \Thelia\Model\FolderQuery A secondary query class using the current class as primary query
    622:      */
    623:     public function useFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    624:     {
    625:         return $this
    626:             ->joinFolder($relationAlias, $joinType)
    627:             ->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery');
    628:     }
    629:
    630:     /**
    631:      * Exclude object from result
    632:      *
    633:      * @param   FolderDesc $folderDesc Object to remove from the list of results
    634:      *
    635:      * @return FolderDescQuery The current query, for fluid interface
    636:      */
    637:     public function prune($folderDesc = null)
    638:     {
    639:         if ($folderDesc) {
    640:             $this->addUsingAlias(FolderDescPeer::ID, $folderDesc->getId(), Criteria::NOT_EQUAL);
    641:         }
    642:
    643:         return $this;
    644:     }
    645:
    646:     // timestampable behavior
    647:
    648:     /**
    649:      * Filter by the latest updated
    650:      *
    651:      * @param      int $nbDays Maximum age of the latest update in days
    652:      *
    653:      * @return     FolderDescQuery The current query, for fluid interface
    654:      */
    655:     public function recentlyUpdated($nbDays = 7)
    656:     {
    657:         return $this->addUsingAlias(FolderDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    658:     }
    659:
    660:     /**
    661:      * Order by update date desc
    662:      *
    663:      * @return     FolderDescQuery The current query, for fluid interface
    664:      */
    665:     public function lastUpdatedFirst()
    666:     {
    667:         return $this->addDescendingOrderByColumn(FolderDescPeer::UPDATED_AT);
    668:     }
    669:
    670:     /**
    671:      * Order by update date asc
    672:      *
    673:      * @return     FolderDescQuery The current query, for fluid interface
    674:      */
    675:     public function firstUpdatedFirst()
    676:     {
    677:         return $this->addAscendingOrderByColumn(FolderDescPeer::UPDATED_AT);
    678:     }
    679:
    680:     /**
    681:      * Filter by the latest created
    682:      *
    683:      * @param      int $nbDays Maximum age of in days
    684:      *
    685:      * @return     FolderDescQuery The current query, for fluid interface
    686:      */
    687:     public function recentlyCreated($nbDays = 7)
    688:     {
    689:         return $this->addUsingAlias(FolderDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    690:     }
    691:
    692:     /**
    693:      * Order by create date desc
    694:      *
    695:      * @return     FolderDescQuery The current query, for fluid interface
    696:      */
    697:     public function lastCreatedFirst()
    698:     {
    699:         return $this->addDescendingOrderByColumn(FolderDescPeer::CREATED_AT);
    700:     }
    701:
    702:     /**
    703:      * Order by create date asc
    704:      *
    705:      * @return     FolderDescQuery The current query, for fluid interface
    706:      */
    707:     public function firstCreatedFirst()
    708:     {
    709:         return $this->addAscendingOrderByColumn(FolderDescPeer::CREATED_AT);
    710:     }
    711: }
    712: