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