Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
  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\AttributeCombination;
 16: use Thelia\Model\Combination;
 17: use Thelia\Model\CombinationPeer;
 18: use Thelia\Model\CombinationQuery;
 19: use Thelia\Model\Stock;
 20: 
 21: /**
 22:  * Base class that represents a query for the 'combination' table.
 23:  *
 24:  *
 25:  *
 26:  * @method CombinationQuery orderById($order = Criteria::ASC) Order by the id column
 27:  * @method CombinationQuery orderByRef($order = Criteria::ASC) Order by the ref column
 28:  * @method CombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
 29:  * @method CombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
 30:  *
 31:  * @method CombinationQuery groupById() Group by the id column
 32:  * @method CombinationQuery groupByRef() Group by the ref column
 33:  * @method CombinationQuery groupByCreatedAt() Group by the created_at column
 34:  * @method CombinationQuery groupByUpdatedAt() Group by the updated_at column
 35:  *
 36:  * @method CombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 37:  * @method CombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 38:  * @method CombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 39:  *
 40:  * @method CombinationQuery leftJoinAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCombination relation
 41:  * @method CombinationQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
 42:  * @method CombinationQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
 43:  *
 44:  * @method CombinationQuery leftJoinStock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Stock relation
 45:  * @method CombinationQuery rightJoinStock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Stock relation
 46:  * @method CombinationQuery innerJoinStock($relationAlias = null) Adds a INNER JOIN clause to the query using the Stock relation
 47:  *
 48:  * @method Combination findOne(PropelPDO $con = null) Return the first Combination matching the query
 49:  * @method Combination findOneOrCreate(PropelPDO $con = null) Return the first Combination matching the query, or a new Combination object populated from the query conditions when no match is found
 50:  *
 51:  * @method Combination findOneByRef(string $ref) Return the first Combination filtered by the ref column
 52:  * @method Combination findOneByCreatedAt(string $created_at) Return the first Combination filtered by the created_at column
 53:  * @method Combination findOneByUpdatedAt(string $updated_at) Return the first Combination filtered by the updated_at column
 54:  *
 55:  * @method array findById(int $id) Return Combination objects filtered by the id column
 56:  * @method array findByRef(string $ref) Return Combination objects filtered by the ref column
 57:  * @method array findByCreatedAt(string $created_at) Return Combination objects filtered by the created_at column
 58:  * @method array findByUpdatedAt(string $updated_at) Return Combination objects filtered by the updated_at column
 59:  *
 60:  * @package    propel.generator.Thelia.Model.om
 61:  */
 62: abstract class BaseCombinationQuery extends ModelCriteria
 63: {
 64:     /**
 65:      * Initializes internal state of BaseCombinationQuery object.
 66:      *
 67:      * @param     string $dbName The dabase name
 68:      * @param     string $modelName The phpName of a model, e.g. 'Book'
 69:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
 70:      */
 71:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Combination', $modelAlias = null)
 72:     {
 73:         parent::__construct($dbName, $modelName, $modelAlias);
 74:     }
 75: 
 76:     /**
 77:      * Returns a new CombinationQuery object.
 78:      *
 79:      * @param     string $modelAlias The alias of a model in the query
 80:      * @param   CombinationQuery|Criteria $criteria Optional Criteria to build the query from
 81:      *
 82:      * @return CombinationQuery
 83:      */
 84:     public static function create($modelAlias = null, $criteria = null)
 85:     {
 86:         if ($criteria instanceof CombinationQuery) {
 87:             return $criteria;
 88:         }
 89:         $query = new CombinationQuery();
 90:         if (null !== $modelAlias) {
 91:             $query->setModelAlias($modelAlias);
 92:         }
 93:         if ($criteria instanceof Criteria) {
 94:             $query->mergeWith($criteria);
 95:         }
 96: 
 97:         return $query;
 98:     }
 99: 
100:     /**
101:      * Find object by primary key.
102:      * Propel uses the instance pool to skip the database if the object exists.
103:      * Go fast if the query is untouched.
104:      *
105:      * <code>
106:      * $obj  = $c->findPk(12, $con);
107:      * </code>
108:      *
109:      * @param mixed $key Primary key to use for the query
110:      * @param     PropelPDO $con an optional connection object
111:      *
112:      * @return   Combination|Combination[]|mixed the result, formatted by the current formatter
113:      */
114:     public function findPk($key, $con = null)
115:     {
116:         if ($key === null) {
117:             return null;
118:         }
119:         if ((null !== ($obj = CombinationPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
120:             // the object is alredy in the instance pool
121:             return $obj;
122:         }
123:         if ($con === null) {
124:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
125:         }
126:         $this->basePreSelect($con);
127:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
128:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
129:          || $this->map || $this->having || $this->joins) {
130:             return $this->findPkComplex($key, $con);
131:         } else {
132:             return $this->findPkSimple($key, $con);
133:         }
134:     }
135: 
136:     /**
137:      * Alias of findPk to use instance pooling
138:      *
139:      * @param     mixed $key Primary key to use for the query
140:      * @param     PropelPDO $con A connection object
141:      *
142:      * @return                 Combination A model object, or null if the key is not found
143:      * @throws PropelException
144:      */
145:      public function findOneById($key, $con = null)
146:      {
147:         return $this->findPk($key, $con);
148:      }
149: 
150:     /**
151:      * Find object by primary key using raw SQL to go fast.
152:      * Bypass doSelect() and the object formatter by using generated code.
153:      *
154:      * @param     mixed $key Primary key to use for the query
155:      * @param     PropelPDO $con A connection object
156:      *
157:      * @return                 Combination A model object, or null if the key is not found
158:      * @throws PropelException
159:      */
160:     protected function findPkSimple($key, $con)
161:     {
162:         $sql = 'SELECT `id`, `ref`, `created_at`, `updated_at` FROM `combination` WHERE `id` = :p0';
163:         try {
164:             $stmt = $con->prepare($sql);
165:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
166:             $stmt->execute();
167:         } catch (Exception $e) {
168:             Propel::log($e->getMessage(), Propel::LOG_ERR);
169:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
170:         }
171:         $obj = null;
172:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
173:             $obj = new Combination();
174:             $obj->hydrate($row);
175:             CombinationPeer::addInstanceToPool($obj, (string) $key);
176:         }
177:         $stmt->closeCursor();
178: 
179:         return $obj;
180:     }
181: 
182:     /**
183:      * Find object by primary key.
184:      *
185:      * @param     mixed $key Primary key to use for the query
186:      * @param     PropelPDO $con A connection object
187:      *
188:      * @return Combination|Combination[]|mixed the result, formatted by the current formatter
189:      */
190:     protected function findPkComplex($key, $con)
191:     {
192:         // As the query uses a PK condition, no limit(1) is necessary.
193:         $criteria = $this->isKeepQuery() ? clone $this : $this;
194:         $stmt = $criteria
195:             ->filterByPrimaryKey($key)
196:             ->doSelect($con);
197: 
198:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
199:     }
200: 
201:     /**
202:      * Find objects by primary key
203:      * <code>
204:      * $objs = $c->findPks(array(12, 56, 832), $con);
205:      * </code>
206:      * @param     array $keys Primary keys to use for the query
207:      * @param     PropelPDO $con an optional connection object
208:      *
209:      * @return PropelObjectCollection|Combination[]|mixed the list of results, formatted by the current formatter
210:      */
211:     public function findPks($keys, $con = null)
212:     {
213:         if ($con === null) {
214:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
215:         }
216:         $this->basePreSelect($con);
217:         $criteria = $this->isKeepQuery() ? clone $this : $this;
218:         $stmt = $criteria
219:             ->filterByPrimaryKeys($keys)
220:             ->doSelect($con);
221: 
222:         return $criteria->getFormatter()->init($criteria)->format($stmt);
223:     }
224: 
225:     /**
226:      * Filter the query by primary key
227:      *
228:      * @param     mixed $key Primary key to use for the query
229:      *
230:      * @return CombinationQuery The current query, for fluid interface
231:      */
232:     public function filterByPrimaryKey($key)
233:     {
234: 
235:         return $this->addUsingAlias(CombinationPeer::ID, $key, Criteria::EQUAL);
236:     }
237: 
238:     /**
239:      * Filter the query by a list of primary keys
240:      *
241:      * @param     array $keys The list of primary key to use for the query
242:      *
243:      * @return CombinationQuery The current query, for fluid interface
244:      */
245:     public function filterByPrimaryKeys($keys)
246:     {
247: 
248:         return $this->addUsingAlias(CombinationPeer::ID, $keys, Criteria::IN);
249:     }
250: 
251:     /**
252:      * Filter the query on the id column
253:      *
254:      * Example usage:
255:      * <code>
256:      * $query->filterById(1234); // WHERE id = 1234
257:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
258:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
259:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
260:      * </code>
261:      *
262:      * @param     mixed $id The value to use as filter.
263:      *              Use scalar values for equality.
264:      *              Use array values for in_array() equivalent.
265:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
266:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
267:      *
268:      * @return CombinationQuery The current query, for fluid interface
269:      */
270:     public function filterById($id = null, $comparison = null)
271:     {
272:         if (is_array($id)) {
273:             $useMinMax = false;
274:             if (isset($id['min'])) {
275:                 $this->addUsingAlias(CombinationPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
276:                 $useMinMax = true;
277:             }
278:             if (isset($id['max'])) {
279:                 $this->addUsingAlias(CombinationPeer::ID, $id['max'], Criteria::LESS_EQUAL);
280:                 $useMinMax = true;
281:             }
282:             if ($useMinMax) {
283:                 return $this;
284:             }
285:             if (null === $comparison) {
286:                 $comparison = Criteria::IN;
287:             }
288:         }
289: 
290:         return $this->addUsingAlias(CombinationPeer::ID, $id, $comparison);
291:     }
292: 
293:     /**
294:      * Filter the query on the ref column
295:      *
296:      * Example usage:
297:      * <code>
298:      * $query->filterByRef('fooValue');   // WHERE ref = 'fooValue'
299:      * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
300:      * </code>
301:      *
302:      * @param     string $ref The value to use as filter.
303:      *              Accepts wildcards (* and % trigger a LIKE)
304:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
305:      *
306:      * @return CombinationQuery The current query, for fluid interface
307:      */
308:     public function filterByRef($ref = null, $comparison = null)
309:     {
310:         if (null === $comparison) {
311:             if (is_array($ref)) {
312:                 $comparison = Criteria::IN;
313:             } elseif (preg_match('/[\%\*]/', $ref)) {
314:                 $ref = str_replace('*', '%', $ref);
315:                 $comparison = Criteria::LIKE;
316:             }
317:         }
318: 
319:         return $this->addUsingAlias(CombinationPeer::REF, $ref, $comparison);
320:     }
321: 
322:     /**
323:      * Filter the query on the created_at column
324:      *
325:      * Example usage:
326:      * <code>
327:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
328:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
329:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
330:      * </code>
331:      *
332:      * @param     mixed $createdAt The value to use as filter.
333:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
334:      *              Empty strings are treated as NULL.
335:      *              Use scalar values for equality.
336:      *              Use array values for in_array() equivalent.
337:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
338:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
339:      *
340:      * @return CombinationQuery The current query, for fluid interface
341:      */
342:     public function filterByCreatedAt($createdAt = null, $comparison = null)
343:     {
344:         if (is_array($createdAt)) {
345:             $useMinMax = false;
346:             if (isset($createdAt['min'])) {
347:                 $this->addUsingAlias(CombinationPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
348:                 $useMinMax = true;
349:             }
350:             if (isset($createdAt['max'])) {
351:                 $this->addUsingAlias(CombinationPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
352:                 $useMinMax = true;
353:             }
354:             if ($useMinMax) {
355:                 return $this;
356:             }
357:             if (null === $comparison) {
358:                 $comparison = Criteria::IN;
359:             }
360:         }
361: 
362:         return $this->addUsingAlias(CombinationPeer::CREATED_AT, $createdAt, $comparison);
363:     }
364: 
365:     /**
366:      * Filter the query on the updated_at column
367:      *
368:      * Example usage:
369:      * <code>
370:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
371:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
372:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
373:      * </code>
374:      *
375:      * @param     mixed $updatedAt The value to use as filter.
376:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
377:      *              Empty strings are treated as NULL.
378:      *              Use scalar values for equality.
379:      *              Use array values for in_array() equivalent.
380:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
381:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
382:      *
383:      * @return CombinationQuery The current query, for fluid interface
384:      */
385:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
386:     {
387:         if (is_array($updatedAt)) {
388:             $useMinMax = false;
389:             if (isset($updatedAt['min'])) {
390:                 $this->addUsingAlias(CombinationPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
391:                 $useMinMax = true;
392:             }
393:             if (isset($updatedAt['max'])) {
394:                 $this->addUsingAlias(CombinationPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
395:                 $useMinMax = true;
396:             }
397:             if ($useMinMax) {
398:                 return $this;
399:             }
400:             if (null === $comparison) {
401:                 $comparison = Criteria::IN;
402:             }
403:         }
404: 
405:         return $this->addUsingAlias(CombinationPeer::UPDATED_AT, $updatedAt, $comparison);
406:     }
407: 
408:     /**
409:      * Filter the query by a related AttributeCombination object
410:      *
411:      * @param   AttributeCombination|PropelObjectCollection $attributeCombination  the related object to use as filter
412:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
413:      *
414:      * @return                 CombinationQuery The current query, for fluid interface
415:      * @throws PropelException - if the provided filter is invalid.
416:      */
417:     public function filterByAttributeCombination($attributeCombination, $comparison = null)
418:     {
419:         if ($attributeCombination instanceof AttributeCombination) {
420:             return $this
421:                 ->addUsingAlias(CombinationPeer::ID, $attributeCombination->getCombinationId(), $comparison);
422:         } elseif ($attributeCombination instanceof PropelObjectCollection) {
423:             return $this
424:                 ->useAttributeCombinationQuery()
425:                 ->filterByPrimaryKeys($attributeCombination->getPrimaryKeys())
426:                 ->endUse();
427:         } else {
428:             throw new PropelException('filterByAttributeCombination() only accepts arguments of type AttributeCombination or PropelCollection');
429:         }
430:     }
431: 
432:     /**
433:      * Adds a JOIN clause to the query using the AttributeCombination relation
434:      *
435:      * @param     string $relationAlias optional alias for the relation
436:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
437:      *
438:      * @return CombinationQuery The current query, for fluid interface
439:      */
440:     public function joinAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
441:     {
442:         $tableMap = $this->getTableMap();
443:         $relationMap = $tableMap->getRelation('AttributeCombination');
444: 
445:         // create a ModelJoin object for this join
446:         $join = new ModelJoin();
447:         $join->setJoinType($joinType);
448:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
449:         if ($previousJoin = $this->getPreviousJoin()) {
450:             $join->setPreviousJoin($previousJoin);
451:         }
452: 
453:         // add the ModelJoin to the current object
454:         if ($relationAlias) {
455:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
456:             $this->addJoinObject($join, $relationAlias);
457:         } else {
458:             $this->addJoinObject($join, 'AttributeCombination');
459:         }
460: 
461:         return $this;
462:     }
463: 
464:     /**
465:      * Use the AttributeCombination relation AttributeCombination object
466:      *
467:      * @see       useQuery()
468:      *
469:      * @param     string $relationAlias optional alias for the relation,
470:      *                                   to be used as main alias in the secondary query
471:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
472:      *
473:      * @return   \Thelia\Model\AttributeCombinationQuery A secondary query class using the current class as primary query
474:      */
475:     public function useAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
476:     {
477:         return $this
478:             ->joinAttributeCombination($relationAlias, $joinType)
479:             ->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
480:     }
481: 
482:     /**
483:      * Filter the query by a related Stock object
484:      *
485:      * @param   Stock|PropelObjectCollection $stock  the related object to use as filter
486:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
487:      *
488:      * @return                 CombinationQuery The current query, for fluid interface
489:      * @throws PropelException - if the provided filter is invalid.
490:      */
491:     public function filterByStock($stock, $comparison = null)
492:     {
493:         if ($stock instanceof Stock) {
494:             return $this
495:                 ->addUsingAlias(CombinationPeer::ID, $stock->getCombinationId(), $comparison);
496:         } elseif ($stock instanceof PropelObjectCollection) {
497:             return $this
498:                 ->useStockQuery()
499:                 ->filterByPrimaryKeys($stock->getPrimaryKeys())
500:                 ->endUse();
501:         } else {
502:             throw new PropelException('filterByStock() only accepts arguments of type Stock or PropelCollection');
503:         }
504:     }
505: 
506:     /**
507:      * Adds a JOIN clause to the query using the Stock relation
508:      *
509:      * @param     string $relationAlias optional alias for the relation
510:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
511:      *
512:      * @return CombinationQuery The current query, for fluid interface
513:      */
514:     public function joinStock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
515:     {
516:         $tableMap = $this->getTableMap();
517:         $relationMap = $tableMap->getRelation('Stock');
518: 
519:         // create a ModelJoin object for this join
520:         $join = new ModelJoin();
521:         $join->setJoinType($joinType);
522:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
523:         if ($previousJoin = $this->getPreviousJoin()) {
524:             $join->setPreviousJoin($previousJoin);
525:         }
526: 
527:         // add the ModelJoin to the current object
528:         if ($relationAlias) {
529:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
530:             $this->addJoinObject($join, $relationAlias);
531:         } else {
532:             $this->addJoinObject($join, 'Stock');
533:         }
534: 
535:         return $this;
536:     }
537: 
538:     /**
539:      * Use the Stock relation Stock object
540:      *
541:      * @see       useQuery()
542:      *
543:      * @param     string $relationAlias optional alias for the relation,
544:      *                                   to be used as main alias in the secondary query
545:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
546:      *
547:      * @return   \Thelia\Model\StockQuery A secondary query class using the current class as primary query
548:      */
549:     public function useStockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
550:     {
551:         return $this
552:             ->joinStock($relationAlias, $joinType)
553:             ->useQuery($relationAlias ? $relationAlias : 'Stock', '\Thelia\Model\StockQuery');
554:     }
555: 
556:     /**
557:      * Exclude object from result
558:      *
559:      * @param   Combination $combination Object to remove from the list of results
560:      *
561:      * @return CombinationQuery The current query, for fluid interface
562:      */
563:     public function prune($combination = null)
564:     {
565:         if ($combination) {
566:             $this->addUsingAlias(CombinationPeer::ID, $combination->getId(), Criteria::NOT_EQUAL);
567:         }
568: 
569:         return $this;
570:     }
571: 
572:     // timestampable behavior
573: 
574:     /**
575:      * Filter by the latest updated
576:      *
577:      * @param      int $nbDays Maximum age of the latest update in days
578:      *
579:      * @return     CombinationQuery The current query, for fluid interface
580:      */
581:     public function recentlyUpdated($nbDays = 7)
582:     {
583:         return $this->addUsingAlias(CombinationPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
584:     }
585: 
586:     /**
587:      * Order by update date desc
588:      *
589:      * @return     CombinationQuery The current query, for fluid interface
590:      */
591:     public function lastUpdatedFirst()
592:     {
593:         return $this->addDescendingOrderByColumn(CombinationPeer::UPDATED_AT);
594:     }
595: 
596:     /**
597:      * Order by update date asc
598:      *
599:      * @return     CombinationQuery The current query, for fluid interface
600:      */
601:     public function firstUpdatedFirst()
602:     {
603:         return $this->addAscendingOrderByColumn(CombinationPeer::UPDATED_AT);
604:     }
605: 
606:     /**
607:      * Filter by the latest created
608:      *
609:      * @param      int $nbDays Maximum age of in days
610:      *
611:      * @return     CombinationQuery The current query, for fluid interface
612:      */
613:     public function recentlyCreated($nbDays = 7)
614:     {
615:         return $this->addUsingAlias(CombinationPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
616:     }
617: 
618:     /**
619:      * Order by create date desc
620:      *
621:      * @return     CombinationQuery The current query, for fluid interface
622:      */
623:     public function lastCreatedFirst()
624:     {
625:         return $this->addDescendingOrderByColumn(CombinationPeer::CREATED_AT);
626:     }
627: 
628:     /**
629:      * Order by create date asc
630:      *
631:      * @return     CombinationQuery The current query, for fluid interface
632:      */
633:     public function firstCreatedFirst()
634:     {
635:         return $this->addAscendingOrderByColumn(CombinationPeer::CREATED_AT);
636:     }
637: }
638: 
thelia API documentation generated by ApiGen 2.8.0