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: * $query->filterById(array('max' => 12)); // WHERE id <= 12
281: * </code>
282: *
283: * @param mixed $id The value to use as filter.
284: * Use scalar values for equality.
285: * Use array values for in_array() equivalent.
286: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
287: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
288: *
289: * @return AttributeCombinationQuery The current query, for fluid interface
290: */
291: public function filterById($id = null, $comparison = null)
292: {
293: if (is_array($id)) {
294: $useMinMax = false;
295: if (isset($id['min'])) {
296: $this->addUsingAlias(AttributeCombinationPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
297: $useMinMax = true;
298: }
299: if (isset($id['max'])) {
300: $this->addUsingAlias(AttributeCombinationPeer::ID, $id['max'], Criteria::LESS_EQUAL);
301: $useMinMax = true;
302: }
303: if ($useMinMax) {
304: return $this;
305: }
306: if (null === $comparison) {
307: $comparison = Criteria::IN;
308: }
309: }
310:
311: return $this->addUsingAlias(AttributeCombinationPeer::ID, $id, $comparison);
312: }
313:
314: /**
315: * Filter the query on the attribute_id column
316: *
317: * Example usage:
318: * <code>
319: * $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
320: * $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
321: * $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id >= 12
322: * $query->filterByAttributeId(array('max' => 12)); // WHERE attribute_id <= 12
323: * </code>
324: *
325: * @see filterByAttribute()
326: *
327: * @param mixed $attributeId The value to use as filter.
328: * Use scalar values for equality.
329: * Use array values for in_array() equivalent.
330: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
331: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
332: *
333: * @return AttributeCombinationQuery The current query, for fluid interface
334: */
335: public function filterByAttributeId($attributeId = null, $comparison = null)
336: {
337: if (is_array($attributeId)) {
338: $useMinMax = false;
339: if (isset($attributeId['min'])) {
340: $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
341: $useMinMax = true;
342: }
343: if (isset($attributeId['max'])) {
344: $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
345: $useMinMax = true;
346: }
347: if ($useMinMax) {
348: return $this;
349: }
350: if (null === $comparison) {
351: $comparison = Criteria::IN;
352: }
353: }
354:
355: return $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attributeId, $comparison);
356: }
357:
358: /**
359: * Filter the query on the combination_id column
360: *
361: * Example usage:
362: * <code>
363: * $query->filterByCombinationId(1234); // WHERE combination_id = 1234
364: * $query->filterByCombinationId(array(12, 34)); // WHERE combination_id IN (12, 34)
365: * $query->filterByCombinationId(array('min' => 12)); // WHERE combination_id >= 12
366: * $query->filterByCombinationId(array('max' => 12)); // WHERE combination_id <= 12
367: * </code>
368: *
369: * @see filterByCombination()
370: *
371: * @param mixed $combinationId The value to use as filter.
372: * Use scalar values for equality.
373: * Use array values for in_array() equivalent.
374: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
375: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
376: *
377: * @return AttributeCombinationQuery The current query, for fluid interface
378: */
379: public function filterByCombinationId($combinationId = null, $comparison = null)
380: {
381: if (is_array($combinationId)) {
382: $useMinMax = false;
383: if (isset($combinationId['min'])) {
384: $this->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combinationId['min'], Criteria::GREATER_EQUAL);
385: $useMinMax = true;
386: }
387: if (isset($combinationId['max'])) {
388: $this->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combinationId['max'], Criteria::LESS_EQUAL);
389: $useMinMax = true;
390: }
391: if ($useMinMax) {
392: return $this;
393: }
394: if (null === $comparison) {
395: $comparison = Criteria::IN;
396: }
397: }
398:
399: return $this->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combinationId, $comparison);
400: }
401:
402: /**
403: * Filter the query on the attribute_av_id column
404: *
405: * Example usage:
406: * <code>
407: * $query->filterByAttributeAvId(1234); // WHERE attribute_av_id = 1234
408: * $query->filterByAttributeAvId(array(12, 34)); // WHERE attribute_av_id IN (12, 34)
409: * $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id >= 12
410: * $query->filterByAttributeAvId(array('max' => 12)); // WHERE attribute_av_id <= 12
411: * </code>
412: *
413: * @see filterByAttributeAv()
414: *
415: * @param mixed $attributeAvId The value to use as filter.
416: * Use scalar values for equality.
417: * Use array values for in_array() equivalent.
418: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
419: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
420: *
421: * @return AttributeCombinationQuery The current query, for fluid interface
422: */
423: public function filterByAttributeAvId($attributeAvId = null, $comparison = null)
424: {
425: if (is_array($attributeAvId)) {
426: $useMinMax = false;
427: if (isset($attributeAvId['min'])) {
428: $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAvId['min'], Criteria::GREATER_EQUAL);
429: $useMinMax = true;
430: }
431: if (isset($attributeAvId['max'])) {
432: $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAvId['max'], Criteria::LESS_EQUAL);
433: $useMinMax = true;
434: }
435: if ($useMinMax) {
436: return $this;
437: }
438: if (null === $comparison) {
439: $comparison = Criteria::IN;
440: }
441: }
442:
443: return $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAvId, $comparison);
444: }
445:
446: /**
447: * Filter the query on the created_at column
448: *
449: * Example usage:
450: * <code>
451: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
452: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
453: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
454: * </code>
455: *
456: * @param mixed $createdAt The value to use as filter.
457: * Values can be integers (unix timestamps), DateTime objects, or strings.
458: * Empty strings are treated as NULL.
459: * Use scalar values for equality.
460: * Use array values for in_array() equivalent.
461: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
462: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
463: *
464: * @return AttributeCombinationQuery The current query, for fluid interface
465: */
466: public function filterByCreatedAt($createdAt = null, $comparison = null)
467: {
468: if (is_array($createdAt)) {
469: $useMinMax = false;
470: if (isset($createdAt['min'])) {
471: $this->addUsingAlias(AttributeCombinationPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
472: $useMinMax = true;
473: }
474: if (isset($createdAt['max'])) {
475: $this->addUsingAlias(AttributeCombinationPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
476: $useMinMax = true;
477: }
478: if ($useMinMax) {
479: return $this;
480: }
481: if (null === $comparison) {
482: $comparison = Criteria::IN;
483: }
484: }
485:
486: return $this->addUsingAlias(AttributeCombinationPeer::CREATED_AT, $createdAt, $comparison);
487: }
488:
489: /**
490: * Filter the query on the updated_at column
491: *
492: * Example usage:
493: * <code>
494: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
495: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
496: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
497: * </code>
498: *
499: * @param mixed $updatedAt The value to use as filter.
500: * Values can be integers (unix timestamps), DateTime objects, or strings.
501: * Empty strings are treated as NULL.
502: * Use scalar values for equality.
503: * Use array values for in_array() equivalent.
504: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
505: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
506: *
507: * @return AttributeCombinationQuery The current query, for fluid interface
508: */
509: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
510: {
511: if (is_array($updatedAt)) {
512: $useMinMax = false;
513: if (isset($updatedAt['min'])) {
514: $this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
515: $useMinMax = true;
516: }
517: if (isset($updatedAt['max'])) {
518: $this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
519: $useMinMax = true;
520: }
521: if ($useMinMax) {
522: return $this;
523: }
524: if (null === $comparison) {
525: $comparison = Criteria::IN;
526: }
527: }
528:
529: return $this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, $updatedAt, $comparison);
530: }
531:
532: /**
533: * Filter the query by a related Attribute object
534: *
535: * @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
536: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
537: *
538: * @return AttributeCombinationQuery The current query, for fluid interface
539: * @throws PropelException - if the provided filter is invalid.
540: */
541: public function filterByAttribute($attribute, $comparison = null)
542: {
543: if ($attribute instanceof Attribute) {
544: return $this
545: ->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
546: } elseif ($attribute instanceof PropelObjectCollection) {
547: if (null === $comparison) {
548: $comparison = Criteria::IN;
549: }
550:
551: return $this
552: ->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
553: } else {
554: throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
555: }
556: }
557:
558: /**
559: * Adds a JOIN clause to the query using the Attribute relation
560: *
561: * @param string $relationAlias optional alias for the relation
562: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
563: *
564: * @return AttributeCombinationQuery The current query, for fluid interface
565: */
566: public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
567: {
568: $tableMap = $this->getTableMap();
569: $relationMap = $tableMap->getRelation('Attribute');
570:
571: // create a ModelJoin object for this join
572: $join = new ModelJoin();
573: $join->setJoinType($joinType);
574: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
575: if ($previousJoin = $this->getPreviousJoin()) {
576: $join->setPreviousJoin($previousJoin);
577: }
578:
579: // add the ModelJoin to the current object
580: if ($relationAlias) {
581: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
582: $this->addJoinObject($join, $relationAlias);
583: } else {
584: $this->addJoinObject($join, 'Attribute');
585: }
586:
587: return $this;
588: }
589:
590: /**
591: * Use the Attribute relation Attribute object
592: *
593: * @see useQuery()
594: *
595: * @param string $relationAlias optional alias for the relation,
596: * to be used as main alias in the secondary query
597: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
598: *
599: * @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
600: */
601: public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
602: {
603: return $this
604: ->joinAttribute($relationAlias, $joinType)
605: ->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
606: }
607:
608: /**
609: * Filter the query by a related AttributeAv object
610: *
611: * @param AttributeAv|PropelObjectCollection $attributeAv The related object(s) to use as filter
612: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
613: *
614: * @return AttributeCombinationQuery The current query, for fluid interface
615: * @throws PropelException - if the provided filter is invalid.
616: */
617: public function filterByAttributeAv($attributeAv, $comparison = null)
618: {
619: if ($attributeAv instanceof AttributeAv) {
620: return $this
621: ->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison);
622: } elseif ($attributeAv instanceof PropelObjectCollection) {
623: if (null === $comparison) {
624: $comparison = Criteria::IN;
625: }
626:
627: return $this
628: ->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
629: } else {
630: throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
631: }
632: }
633:
634: /**
635: * Adds a JOIN clause to the query using the AttributeAv relation
636: *
637: * @param string $relationAlias optional alias for the relation
638: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
639: *
640: * @return AttributeCombinationQuery The current query, for fluid interface
641: */
642: public function joinAttributeAv($relationAlias = null, $joinType = Criteria::INNER_JOIN)
643: {
644: $tableMap = $this->getTableMap();
645: $relationMap = $tableMap->getRelation('AttributeAv');
646:
647: // create a ModelJoin object for this join
648: $join = new ModelJoin();
649: $join->setJoinType($joinType);
650: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
651: if ($previousJoin = $this->getPreviousJoin()) {
652: $join->setPreviousJoin($previousJoin);
653: }
654:
655: // add the ModelJoin to the current object
656: if ($relationAlias) {
657: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
658: $this->addJoinObject($join, $relationAlias);
659: } else {
660: $this->addJoinObject($join, 'AttributeAv');
661: }
662:
663: return $this;
664: }
665:
666: /**
667: * Use the AttributeAv relation AttributeAv object
668: *
669: * @see useQuery()
670: *
671: * @param string $relationAlias optional alias for the relation,
672: * to be used as main alias in the secondary query
673: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
674: *
675: * @return \Thelia\Model\AttributeAvQuery A secondary query class using the current class as primary query
676: */
677: public function useAttributeAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
678: {
679: return $this
680: ->joinAttributeAv($relationAlias, $joinType)
681: ->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery');
682: }
683:
684: /**
685: * Filter the query by a related Combination object
686: *
687: * @param Combination|PropelObjectCollection $combination The related object(s) to use as filter
688: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
689: *
690: * @return AttributeCombinationQuery The current query, for fluid interface
691: * @throws PropelException - if the provided filter is invalid.
692: */
693: public function filterByCombination($combination, $comparison = null)
694: {
695: if ($combination instanceof Combination) {
696: return $this
697: ->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->getId(), $comparison);
698: } elseif ($combination instanceof PropelObjectCollection) {
699: if (null === $comparison) {
700: $comparison = Criteria::IN;
701: }
702:
703: return $this
704: ->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->toKeyValue('PrimaryKey', 'Id'), $comparison);
705: } else {
706: throw new PropelException('filterByCombination() only accepts arguments of type Combination or PropelCollection');
707: }
708: }
709:
710: /**
711: * Adds a JOIN clause to the query using the Combination relation
712: *
713: * @param string $relationAlias optional alias for the relation
714: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
715: *
716: * @return AttributeCombinationQuery The current query, for fluid interface
717: */
718: public function joinCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
719: {
720: $tableMap = $this->getTableMap();
721: $relationMap = $tableMap->getRelation('Combination');
722:
723: // create a ModelJoin object for this join
724: $join = new ModelJoin();
725: $join->setJoinType($joinType);
726: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
727: if ($previousJoin = $this->getPreviousJoin()) {
728: $join->setPreviousJoin($previousJoin);
729: }
730:
731: // add the ModelJoin to the current object
732: if ($relationAlias) {
733: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
734: $this->addJoinObject($join, $relationAlias);
735: } else {
736: $this->addJoinObject($join, 'Combination');
737: }
738:
739: return $this;
740: }
741:
742: /**
743: * Use the Combination relation Combination object
744: *
745: * @see useQuery()
746: *
747: * @param string $relationAlias optional alias for the relation,
748: * to be used as main alias in the secondary query
749: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
750: *
751: * @return \Thelia\Model\CombinationQuery A secondary query class using the current class as primary query
752: */
753: public function useCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
754: {
755: return $this
756: ->joinCombination($relationAlias, $joinType)
757: ->useQuery($relationAlias ? $relationAlias : 'Combination', '\Thelia\Model\CombinationQuery');
758: }
759:
760: /**
761: * Exclude object from result
762: *
763: * @param AttributeCombination $attributeCombination Object to remove from the list of results
764: *
765: * @return AttributeCombinationQuery The current query, for fluid interface
766: */
767: public function prune($attributeCombination = null)
768: {
769: if ($attributeCombination) {
770: $this->addCond('pruneCond0', $this->getAliasedColName(AttributeCombinationPeer::ID), $attributeCombination->getId(), Criteria::NOT_EQUAL);
771: $this->addCond('pruneCond1', $this->getAliasedColName(AttributeCombinationPeer::ATTRIBUTE_ID), $attributeCombination->getAttributeId(), Criteria::NOT_EQUAL);
772: $this->addCond('pruneCond2', $this->getAliasedColName(AttributeCombinationPeer::COMBINATION_ID), $attributeCombination->getCombinationId(), Criteria::NOT_EQUAL);
773: $this->addCond('pruneCond3', $this->getAliasedColName(AttributeCombinationPeer::ATTRIBUTE_AV_ID), $attributeCombination->getAttributeAvId(), Criteria::NOT_EQUAL);
774: $this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2', 'pruneCond3'), Criteria::LOGICAL_OR);
775: }
776:
777: return $this;
778: }
779:
780: // timestampable behavior
781:
782: /**
783: * Filter by the latest updated
784: *
785: * @param int $nbDays Maximum age of the latest update in days
786: *
787: * @return AttributeCombinationQuery The current query, for fluid interface
788: */
789: public function recentlyUpdated($nbDays = 7)
790: {
791: return $this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
792: }
793:
794: /**
795: * Order by update date desc
796: *
797: * @return AttributeCombinationQuery The current query, for fluid interface
798: */
799: public function lastUpdatedFirst()
800: {
801: return $this->addDescendingOrderByColumn(AttributeCombinationPeer::UPDATED_AT);
802: }
803:
804: /**
805: * Order by update date asc
806: *
807: * @return AttributeCombinationQuery The current query, for fluid interface
808: */
809: public function firstUpdatedFirst()
810: {
811: return $this->addAscendingOrderByColumn(AttributeCombinationPeer::UPDATED_AT);
812: }
813:
814: /**
815: * Filter by the latest created
816: *
817: * @param int $nbDays Maximum age of in days
818: *
819: * @return AttributeCombinationQuery The current query, for fluid interface
820: */
821: public function recentlyCreated($nbDays = 7)
822: {
823: return $this->addUsingAlias(AttributeCombinationPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
824: }
825:
826: /**
827: * Order by create date desc
828: *
829: * @return AttributeCombinationQuery The current query, for fluid interface
830: */
831: public function lastCreatedFirst()
832: {
833: return $this->addDescendingOrderByColumn(AttributeCombinationPeer::CREATED_AT);
834: }
835:
836: /**
837: * Order by create date asc
838: *
839: * @return AttributeCombinationQuery The current query, for fluid interface
840: */
841: public function firstCreatedFirst()
842: {
843: return $this->addAscendingOrderByColumn(AttributeCombinationPeer::CREATED_AT);
844: }
845: }
846: