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