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