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