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