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