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