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\Category;
16: use Thelia\Model\Content;
17: use Thelia\Model\Folder;
18: use Thelia\Model\Image;
19: use Thelia\Model\ImageI18n;
20: use Thelia\Model\ImagePeer;
21: use Thelia\Model\ImageQuery;
22: use Thelia\Model\Product;
23:
24: /**
25: * Base class that represents a query for the 'image' table.
26: *
27: *
28: *
29: * @method ImageQuery orderById($order = Criteria::ASC) Order by the id column
30: * @method ImageQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
31: * @method ImageQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
32: * @method ImageQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column
33: * @method ImageQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
34: * @method ImageQuery orderByFile($order = Criteria::ASC) Order by the file column
35: * @method ImageQuery orderByPosition($order = Criteria::ASC) Order by the position column
36: * @method ImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
37: * @method ImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
38: *
39: * @method ImageQuery groupById() Group by the id column
40: * @method ImageQuery groupByProductId() Group by the product_id column
41: * @method ImageQuery groupByCategoryId() Group by the category_id column
42: * @method ImageQuery groupByFolderId() Group by the folder_id column
43: * @method ImageQuery groupByContentId() Group by the content_id column
44: * @method ImageQuery groupByFile() Group by the file column
45: * @method ImageQuery groupByPosition() Group by the position column
46: * @method ImageQuery groupByCreatedAt() Group by the created_at column
47: * @method ImageQuery groupByUpdatedAt() Group by the updated_at column
48: *
49: * @method ImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
50: * @method ImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
51: * @method ImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
52: *
53: * @method ImageQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
54: * @method ImageQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
55: * @method ImageQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
56: *
57: * @method ImageQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
58: * @method ImageQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
59: * @method ImageQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
60: *
61: * @method ImageQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
62: * @method ImageQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
63: * @method ImageQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
64: *
65: * @method ImageQuery leftJoinFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Folder relation
66: * @method ImageQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
67: * @method ImageQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
68: *
69: * @method ImageQuery leftJoinImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImageI18n relation
70: * @method ImageQuery rightJoinImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImageI18n relation
71: * @method ImageQuery innerJoinImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImageI18n relation
72: *
73: * @method Image findOne(PropelPDO $con = null) Return the first Image matching the query
74: * @method Image findOneOrCreate(PropelPDO $con = null) Return the first Image matching the query, or a new Image object populated from the query conditions when no match is found
75: *
76: * @method Image findOneByProductId(int $product_id) Return the first Image filtered by the product_id column
77: * @method Image findOneByCategoryId(int $category_id) Return the first Image filtered by the category_id column
78: * @method Image findOneByFolderId(int $folder_id) Return the first Image filtered by the folder_id column
79: * @method Image findOneByContentId(int $content_id) Return the first Image filtered by the content_id column
80: * @method Image findOneByFile(string $file) Return the first Image filtered by the file column
81: * @method Image findOneByPosition(int $position) Return the first Image filtered by the position column
82: * @method Image findOneByCreatedAt(string $created_at) Return the first Image filtered by the created_at column
83: * @method Image findOneByUpdatedAt(string $updated_at) Return the first Image filtered by the updated_at column
84: *
85: * @method array findById(int $id) Return Image objects filtered by the id column
86: * @method array findByProductId(int $product_id) Return Image objects filtered by the product_id column
87: * @method array findByCategoryId(int $category_id) Return Image objects filtered by the category_id column
88: * @method array findByFolderId(int $folder_id) Return Image objects filtered by the folder_id column
89: * @method array findByContentId(int $content_id) Return Image objects filtered by the content_id column
90: * @method array findByFile(string $file) Return Image objects filtered by the file column
91: * @method array findByPosition(int $position) Return Image objects filtered by the position column
92: * @method array findByCreatedAt(string $created_at) Return Image objects filtered by the created_at column
93: * @method array findByUpdatedAt(string $updated_at) Return Image objects filtered by the updated_at column
94: *
95: * @package propel.generator.Thelia.Model.om
96: */
97: abstract class BaseImageQuery extends ModelCriteria
98: {
99: /**
100: * Initializes internal state of BaseImageQuery object.
101: *
102: * @param string $dbName The dabase name
103: * @param string $modelName The phpName of a model, e.g. 'Book'
104: * @param string $modelAlias The alias for the model in this query, e.g. 'b'
105: */
106: public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Image', $modelAlias = null)
107: {
108: parent::__construct($dbName, $modelName, $modelAlias);
109: }
110:
111: /**
112: * Returns a new ImageQuery object.
113: *
114: * @param string $modelAlias The alias of a model in the query
115: * @param ImageQuery|Criteria $criteria Optional Criteria to build the query from
116: *
117: * @return ImageQuery
118: */
119: public static function create($modelAlias = null, $criteria = null)
120: {
121: if ($criteria instanceof ImageQuery) {
122: return $criteria;
123: }
124: $query = new ImageQuery();
125: if (null !== $modelAlias) {
126: $query->setModelAlias($modelAlias);
127: }
128: if ($criteria instanceof Criteria) {
129: $query->mergeWith($criteria);
130: }
131:
132: return $query;
133: }
134:
135: /**
136: * Find object by primary key.
137: * Propel uses the instance pool to skip the database if the object exists.
138: * Go fast if the query is untouched.
139: *
140: * <code>
141: * $obj = $c->findPk(12, $con);
142: * </code>
143: *
144: * @param mixed $key Primary key to use for the query
145: * @param PropelPDO $con an optional connection object
146: *
147: * @return Image|Image[]|mixed the result, formatted by the current formatter
148: */
149: public function findPk($key, $con = null)
150: {
151: if ($key === null) {
152: return null;
153: }
154: if ((null !== ($obj = ImagePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
155: // the object is alredy in the instance pool
156: return $obj;
157: }
158: if ($con === null) {
159: $con = Propel::getConnection(ImagePeer::DATABASE_NAME, Propel::CONNECTION_READ);
160: }
161: $this->basePreSelect($con);
162: if ($this->formatter || $this->modelAlias || $this->with || $this->select
163: || $this->selectColumns || $this->asColumns || $this->selectModifiers
164: || $this->map || $this->having || $this->joins) {
165: return $this->findPkComplex($key, $con);
166: } else {
167: return $this->findPkSimple($key, $con);
168: }
169: }
170:
171: /**
172: * Alias of findPk to use instance pooling
173: *
174: * @param mixed $key Primary key to use for the query
175: * @param PropelPDO $con A connection object
176: *
177: * @return Image A model object, or null if the key is not found
178: * @throws PropelException
179: */
180: public function findOneById($key, $con = null)
181: {
182: return $this->findPk($key, $con);
183: }
184:
185: /**
186: * Find object by primary key using raw SQL to go fast.
187: * Bypass doSelect() and the object formatter by using generated code.
188: *
189: * @param mixed $key Primary key to use for the query
190: * @param PropelPDO $con A connection object
191: *
192: * @return Image A model object, or null if the key is not found
193: * @throws PropelException
194: */
195: protected function findPkSimple($key, $con)
196: {
197: $sql = 'SELECT `id`, `product_id`, `category_id`, `folder_id`, `content_id`, `file`, `position`, `created_at`, `updated_at` FROM `image` WHERE `id` = :p0';
198: try {
199: $stmt = $con->prepare($sql);
200: $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
201: $stmt->execute();
202: } catch (Exception $e) {
203: Propel::log($e->getMessage(), Propel::LOG_ERR);
204: throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
205: }
206: $obj = null;
207: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
208: $obj = new Image();
209: $obj->hydrate($row);
210: ImagePeer::addInstanceToPool($obj, (string) $key);
211: }
212: $stmt->closeCursor();
213:
214: return $obj;
215: }
216:
217: /**
218: * Find object by primary key.
219: *
220: * @param mixed $key Primary key to use for the query
221: * @param PropelPDO $con A connection object
222: *
223: * @return Image|Image[]|mixed the result, formatted by the current formatter
224: */
225: protected function findPkComplex($key, $con)
226: {
227: // As the query uses a PK condition, no limit(1) is necessary.
228: $criteria = $this->isKeepQuery() ? clone $this : $this;
229: $stmt = $criteria
230: ->filterByPrimaryKey($key)
231: ->doSelect($con);
232:
233: return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
234: }
235:
236: /**
237: * Find objects by primary key
238: * <code>
239: * $objs = $c->findPks(array(12, 56, 832), $con);
240: * </code>
241: * @param array $keys Primary keys to use for the query
242: * @param PropelPDO $con an optional connection object
243: *
244: * @return PropelObjectCollection|Image[]|mixed the list of results, formatted by the current formatter
245: */
246: public function findPks($keys, $con = null)
247: {
248: if ($con === null) {
249: $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
250: }
251: $this->basePreSelect($con);
252: $criteria = $this->isKeepQuery() ? clone $this : $this;
253: $stmt = $criteria
254: ->filterByPrimaryKeys($keys)
255: ->doSelect($con);
256:
257: return $criteria->getFormatter()->init($criteria)->format($stmt);
258: }
259:
260: /**
261: * Filter the query by primary key
262: *
263: * @param mixed $key Primary key to use for the query
264: *
265: * @return ImageQuery The current query, for fluid interface
266: */
267: public function filterByPrimaryKey($key)
268: {
269:
270: return $this->addUsingAlias(ImagePeer::ID, $key, Criteria::EQUAL);
271: }
272:
273: /**
274: * Filter the query by a list of primary keys
275: *
276: * @param array $keys The list of primary key to use for the query
277: *
278: * @return ImageQuery The current query, for fluid interface
279: */
280: public function filterByPrimaryKeys($keys)
281: {
282:
283: return $this->addUsingAlias(ImagePeer::ID, $keys, Criteria::IN);
284: }
285:
286: /**
287: * Filter the query on the id column
288: *
289: * Example usage:
290: * <code>
291: * $query->filterById(1234); // WHERE id = 1234
292: * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
293: * $query->filterById(array('min' => 12)); // WHERE id >= 12
294: * $query->filterById(array('max' => 12)); // WHERE id <= 12
295: * </code>
296: *
297: * @param mixed $id The value to use as filter.
298: * Use scalar values for equality.
299: * Use array values for in_array() equivalent.
300: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
301: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
302: *
303: * @return ImageQuery The current query, for fluid interface
304: */
305: public function filterById($id = null, $comparison = null)
306: {
307: if (is_array($id)) {
308: $useMinMax = false;
309: if (isset($id['min'])) {
310: $this->addUsingAlias(ImagePeer::ID, $id['min'], Criteria::GREATER_EQUAL);
311: $useMinMax = true;
312: }
313: if (isset($id['max'])) {
314: $this->addUsingAlias(ImagePeer::ID, $id['max'], Criteria::LESS_EQUAL);
315: $useMinMax = true;
316: }
317: if ($useMinMax) {
318: return $this;
319: }
320: if (null === $comparison) {
321: $comparison = Criteria::IN;
322: }
323: }
324:
325: return $this->addUsingAlias(ImagePeer::ID, $id, $comparison);
326: }
327:
328: /**
329: * Filter the query on the product_id column
330: *
331: * Example usage:
332: * <code>
333: * $query->filterByProductId(1234); // WHERE product_id = 1234
334: * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
335: * $query->filterByProductId(array('min' => 12)); // WHERE product_id >= 12
336: * $query->filterByProductId(array('max' => 12)); // WHERE product_id <= 12
337: * </code>
338: *
339: * @see filterByProduct()
340: *
341: * @param mixed $productId 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 ImageQuery The current query, for fluid interface
348: */
349: public function filterByProductId($productId = null, $comparison = null)
350: {
351: if (is_array($productId)) {
352: $useMinMax = false;
353: if (isset($productId['min'])) {
354: $this->addUsingAlias(ImagePeer::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
355: $useMinMax = true;
356: }
357: if (isset($productId['max'])) {
358: $this->addUsingAlias(ImagePeer::PRODUCT_ID, $productId['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(ImagePeer::PRODUCT_ID, $productId, $comparison);
370: }
371:
372: /**
373: * Filter the query on the category_id column
374: *
375: * Example usage:
376: * <code>
377: * $query->filterByCategoryId(1234); // WHERE category_id = 1234
378: * $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34)
379: * $query->filterByCategoryId(array('min' => 12)); // WHERE category_id >= 12
380: * $query->filterByCategoryId(array('max' => 12)); // WHERE category_id <= 12
381: * </code>
382: *
383: * @see filterByCategory()
384: *
385: * @param mixed $categoryId The value to use as filter.
386: * Use scalar values for equality.
387: * Use array values for in_array() equivalent.
388: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
389: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
390: *
391: * @return ImageQuery The current query, for fluid interface
392: */
393: public function filterByCategoryId($categoryId = null, $comparison = null)
394: {
395: if (is_array($categoryId)) {
396: $useMinMax = false;
397: if (isset($categoryId['min'])) {
398: $this->addUsingAlias(ImagePeer::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
399: $useMinMax = true;
400: }
401: if (isset($categoryId['max'])) {
402: $this->addUsingAlias(ImagePeer::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
403: $useMinMax = true;
404: }
405: if ($useMinMax) {
406: return $this;
407: }
408: if (null === $comparison) {
409: $comparison = Criteria::IN;
410: }
411: }
412:
413: return $this->addUsingAlias(ImagePeer::CATEGORY_ID, $categoryId, $comparison);
414: }
415:
416: /**
417: * Filter the query on the folder_id column
418: *
419: * Example usage:
420: * <code>
421: * $query->filterByFolderId(1234); // WHERE folder_id = 1234
422: * $query->filterByFolderId(array(12, 34)); // WHERE folder_id IN (12, 34)
423: * $query->filterByFolderId(array('min' => 12)); // WHERE folder_id >= 12
424: * $query->filterByFolderId(array('max' => 12)); // WHERE folder_id <= 12
425: * </code>
426: *
427: * @see filterByFolder()
428: *
429: * @param mixed $folderId The value to use as filter.
430: * Use scalar values for equality.
431: * Use array values for in_array() equivalent.
432: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
433: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
434: *
435: * @return ImageQuery The current query, for fluid interface
436: */
437: public function filterByFolderId($folderId = null, $comparison = null)
438: {
439: if (is_array($folderId)) {
440: $useMinMax = false;
441: if (isset($folderId['min'])) {
442: $this->addUsingAlias(ImagePeer::FOLDER_ID, $folderId['min'], Criteria::GREATER_EQUAL);
443: $useMinMax = true;
444: }
445: if (isset($folderId['max'])) {
446: $this->addUsingAlias(ImagePeer::FOLDER_ID, $folderId['max'], Criteria::LESS_EQUAL);
447: $useMinMax = true;
448: }
449: if ($useMinMax) {
450: return $this;
451: }
452: if (null === $comparison) {
453: $comparison = Criteria::IN;
454: }
455: }
456:
457: return $this->addUsingAlias(ImagePeer::FOLDER_ID, $folderId, $comparison);
458: }
459:
460: /**
461: * Filter the query on the content_id column
462: *
463: * Example usage:
464: * <code>
465: * $query->filterByContentId(1234); // WHERE content_id = 1234
466: * $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
467: * $query->filterByContentId(array('min' => 12)); // WHERE content_id >= 12
468: * $query->filterByContentId(array('max' => 12)); // WHERE content_id <= 12
469: * </code>
470: *
471: * @see filterByContent()
472: *
473: * @param mixed $contentId The value to use as filter.
474: * Use scalar values for equality.
475: * Use array values for in_array() equivalent.
476: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
477: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
478: *
479: * @return ImageQuery The current query, for fluid interface
480: */
481: public function filterByContentId($contentId = null, $comparison = null)
482: {
483: if (is_array($contentId)) {
484: $useMinMax = false;
485: if (isset($contentId['min'])) {
486: $this->addUsingAlias(ImagePeer::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
487: $useMinMax = true;
488: }
489: if (isset($contentId['max'])) {
490: $this->addUsingAlias(ImagePeer::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
491: $useMinMax = true;
492: }
493: if ($useMinMax) {
494: return $this;
495: }
496: if (null === $comparison) {
497: $comparison = Criteria::IN;
498: }
499: }
500:
501: return $this->addUsingAlias(ImagePeer::CONTENT_ID, $contentId, $comparison);
502: }
503:
504: /**
505: * Filter the query on the file column
506: *
507: * Example usage:
508: * <code>
509: * $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
510: * $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
511: * </code>
512: *
513: * @param string $file The value to use as filter.
514: * Accepts wildcards (* and % trigger a LIKE)
515: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
516: *
517: * @return ImageQuery The current query, for fluid interface
518: */
519: public function filterByFile($file = null, $comparison = null)
520: {
521: if (null === $comparison) {
522: if (is_array($file)) {
523: $comparison = Criteria::IN;
524: } elseif (preg_match('/[\%\*]/', $file)) {
525: $file = str_replace('*', '%', $file);
526: $comparison = Criteria::LIKE;
527: }
528: }
529:
530: return $this->addUsingAlias(ImagePeer::FILE, $file, $comparison);
531: }
532:
533: /**
534: * Filter the query on the position column
535: *
536: * Example usage:
537: * <code>
538: * $query->filterByPosition(1234); // WHERE position = 1234
539: * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
540: * $query->filterByPosition(array('min' => 12)); // WHERE position >= 12
541: * $query->filterByPosition(array('max' => 12)); // WHERE position <= 12
542: * </code>
543: *
544: * @param mixed $position The value to use as filter.
545: * Use scalar values for equality.
546: * Use array values for in_array() equivalent.
547: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
548: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
549: *
550: * @return ImageQuery The current query, for fluid interface
551: */
552: public function filterByPosition($position = null, $comparison = null)
553: {
554: if (is_array($position)) {
555: $useMinMax = false;
556: if (isset($position['min'])) {
557: $this->addUsingAlias(ImagePeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
558: $useMinMax = true;
559: }
560: if (isset($position['max'])) {
561: $this->addUsingAlias(ImagePeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
562: $useMinMax = true;
563: }
564: if ($useMinMax) {
565: return $this;
566: }
567: if (null === $comparison) {
568: $comparison = Criteria::IN;
569: }
570: }
571:
572: return $this->addUsingAlias(ImagePeer::POSITION, $position, $comparison);
573: }
574:
575: /**
576: * Filter the query on the created_at column
577: *
578: * Example usage:
579: * <code>
580: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
581: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
582: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
583: * </code>
584: *
585: * @param mixed $createdAt The value to use as filter.
586: * Values can be integers (unix timestamps), DateTime objects, or strings.
587: * Empty strings are treated as NULL.
588: * Use scalar values for equality.
589: * Use array values for in_array() equivalent.
590: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
591: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
592: *
593: * @return ImageQuery The current query, for fluid interface
594: */
595: public function filterByCreatedAt($createdAt = null, $comparison = null)
596: {
597: if (is_array($createdAt)) {
598: $useMinMax = false;
599: if (isset($createdAt['min'])) {
600: $this->addUsingAlias(ImagePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
601: $useMinMax = true;
602: }
603: if (isset($createdAt['max'])) {
604: $this->addUsingAlias(ImagePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
605: $useMinMax = true;
606: }
607: if ($useMinMax) {
608: return $this;
609: }
610: if (null === $comparison) {
611: $comparison = Criteria::IN;
612: }
613: }
614:
615: return $this->addUsingAlias(ImagePeer::CREATED_AT, $createdAt, $comparison);
616: }
617:
618: /**
619: * Filter the query on the updated_at column
620: *
621: * Example usage:
622: * <code>
623: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
624: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
625: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
626: * </code>
627: *
628: * @param mixed $updatedAt The value to use as filter.
629: * Values can be integers (unix timestamps), DateTime objects, or strings.
630: * Empty strings are treated as NULL.
631: * Use scalar values for equality.
632: * Use array values for in_array() equivalent.
633: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
634: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
635: *
636: * @return ImageQuery The current query, for fluid interface
637: */
638: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
639: {
640: if (is_array($updatedAt)) {
641: $useMinMax = false;
642: if (isset($updatedAt['min'])) {
643: $this->addUsingAlias(ImagePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
644: $useMinMax = true;
645: }
646: if (isset($updatedAt['max'])) {
647: $this->addUsingAlias(ImagePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
648: $useMinMax = true;
649: }
650: if ($useMinMax) {
651: return $this;
652: }
653: if (null === $comparison) {
654: $comparison = Criteria::IN;
655: }
656: }
657:
658: return $this->addUsingAlias(ImagePeer::UPDATED_AT, $updatedAt, $comparison);
659: }
660:
661: /**
662: * Filter the query by a related Product object
663: *
664: * @param Product|PropelObjectCollection $product The related object(s) to use as filter
665: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
666: *
667: * @return ImageQuery The current query, for fluid interface
668: * @throws PropelException - if the provided filter is invalid.
669: */
670: public function filterByProduct($product, $comparison = null)
671: {
672: if ($product instanceof Product) {
673: return $this
674: ->addUsingAlias(ImagePeer::PRODUCT_ID, $product->getId(), $comparison);
675: } elseif ($product instanceof PropelObjectCollection) {
676: if (null === $comparison) {
677: $comparison = Criteria::IN;
678: }
679:
680: return $this
681: ->addUsingAlias(ImagePeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
682: } else {
683: throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
684: }
685: }
686:
687: /**
688: * Adds a JOIN clause to the query using the Product relation
689: *
690: * @param string $relationAlias optional alias for the relation
691: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
692: *
693: * @return ImageQuery The current query, for fluid interface
694: */
695: public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
696: {
697: $tableMap = $this->getTableMap();
698: $relationMap = $tableMap->getRelation('Product');
699:
700: // create a ModelJoin object for this join
701: $join = new ModelJoin();
702: $join->setJoinType($joinType);
703: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
704: if ($previousJoin = $this->getPreviousJoin()) {
705: $join->setPreviousJoin($previousJoin);
706: }
707:
708: // add the ModelJoin to the current object
709: if ($relationAlias) {
710: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
711: $this->addJoinObject($join, $relationAlias);
712: } else {
713: $this->addJoinObject($join, 'Product');
714: }
715:
716: return $this;
717: }
718:
719: /**
720: * Use the Product relation Product object
721: *
722: * @see useQuery()
723: *
724: * @param string $relationAlias optional alias for the relation,
725: * to be used as main alias in the secondary query
726: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
727: *
728: * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
729: */
730: public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
731: {
732: return $this
733: ->joinProduct($relationAlias, $joinType)
734: ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
735: }
736:
737: /**
738: * Filter the query by a related Category object
739: *
740: * @param Category|PropelObjectCollection $category The related object(s) to use as filter
741: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
742: *
743: * @return ImageQuery The current query, for fluid interface
744: * @throws PropelException - if the provided filter is invalid.
745: */
746: public function filterByCategory($category, $comparison = null)
747: {
748: if ($category instanceof Category) {
749: return $this
750: ->addUsingAlias(ImagePeer::CATEGORY_ID, $category->getId(), $comparison);
751: } elseif ($category instanceof PropelObjectCollection) {
752: if (null === $comparison) {
753: $comparison = Criteria::IN;
754: }
755:
756: return $this
757: ->addUsingAlias(ImagePeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
758: } else {
759: throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
760: }
761: }
762:
763: /**
764: * Adds a JOIN clause to the query using the Category relation
765: *
766: * @param string $relationAlias optional alias for the relation
767: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
768: *
769: * @return ImageQuery The current query, for fluid interface
770: */
771: public function joinCategory($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
772: {
773: $tableMap = $this->getTableMap();
774: $relationMap = $tableMap->getRelation('Category');
775:
776: // create a ModelJoin object for this join
777: $join = new ModelJoin();
778: $join->setJoinType($joinType);
779: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
780: if ($previousJoin = $this->getPreviousJoin()) {
781: $join->setPreviousJoin($previousJoin);
782: }
783:
784: // add the ModelJoin to the current object
785: if ($relationAlias) {
786: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
787: $this->addJoinObject($join, $relationAlias);
788: } else {
789: $this->addJoinObject($join, 'Category');
790: }
791:
792: return $this;
793: }
794:
795: /**
796: * Use the Category relation Category object
797: *
798: * @see useQuery()
799: *
800: * @param string $relationAlias optional alias for the relation,
801: * to be used as main alias in the secondary query
802: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
803: *
804: * @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
805: */
806: public function useCategoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
807: {
808: return $this
809: ->joinCategory($relationAlias, $joinType)
810: ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
811: }
812:
813: /**
814: * Filter the query by a related Content object
815: *
816: * @param Content|PropelObjectCollection $content The related object(s) to use as filter
817: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
818: *
819: * @return ImageQuery The current query, for fluid interface
820: * @throws PropelException - if the provided filter is invalid.
821: */
822: public function filterByContent($content, $comparison = null)
823: {
824: if ($content instanceof Content) {
825: return $this
826: ->addUsingAlias(ImagePeer::CONTENT_ID, $content->getId(), $comparison);
827: } elseif ($content instanceof PropelObjectCollection) {
828: if (null === $comparison) {
829: $comparison = Criteria::IN;
830: }
831:
832: return $this
833: ->addUsingAlias(ImagePeer::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
834: } else {
835: throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
836: }
837: }
838:
839: /**
840: * Adds a JOIN clause to the query using the Content relation
841: *
842: * @param string $relationAlias optional alias for the relation
843: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
844: *
845: * @return ImageQuery The current query, for fluid interface
846: */
847: public function joinContent($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
848: {
849: $tableMap = $this->getTableMap();
850: $relationMap = $tableMap->getRelation('Content');
851:
852: // create a ModelJoin object for this join
853: $join = new ModelJoin();
854: $join->setJoinType($joinType);
855: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
856: if ($previousJoin = $this->getPreviousJoin()) {
857: $join->setPreviousJoin($previousJoin);
858: }
859:
860: // add the ModelJoin to the current object
861: if ($relationAlias) {
862: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
863: $this->addJoinObject($join, $relationAlias);
864: } else {
865: $this->addJoinObject($join, 'Content');
866: }
867:
868: return $this;
869: }
870:
871: /**
872: * Use the Content relation Content object
873: *
874: * @see useQuery()
875: *
876: * @param string $relationAlias optional alias for the relation,
877: * to be used as main alias in the secondary query
878: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
879: *
880: * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
881: */
882: public function useContentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
883: {
884: return $this
885: ->joinContent($relationAlias, $joinType)
886: ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
887: }
888:
889: /**
890: * Filter the query by a related Folder object
891: *
892: * @param Folder|PropelObjectCollection $folder The related object(s) to use as filter
893: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
894: *
895: * @return ImageQuery The current query, for fluid interface
896: * @throws PropelException - if the provided filter is invalid.
897: */
898: public function filterByFolder($folder, $comparison = null)
899: {
900: if ($folder instanceof Folder) {
901: return $this
902: ->addUsingAlias(ImagePeer::FOLDER_ID, $folder->getId(), $comparison);
903: } elseif ($folder instanceof PropelObjectCollection) {
904: if (null === $comparison) {
905: $comparison = Criteria::IN;
906: }
907:
908: return $this
909: ->addUsingAlias(ImagePeer::FOLDER_ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison);
910: } else {
911: throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection');
912: }
913: }
914:
915: /**
916: * Adds a JOIN clause to the query using the Folder relation
917: *
918: * @param string $relationAlias optional alias for the relation
919: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
920: *
921: * @return ImageQuery The current query, for fluid interface
922: */
923: public function joinFolder($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
924: {
925: $tableMap = $this->getTableMap();
926: $relationMap = $tableMap->getRelation('Folder');
927:
928: // create a ModelJoin object for this join
929: $join = new ModelJoin();
930: $join->setJoinType($joinType);
931: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
932: if ($previousJoin = $this->getPreviousJoin()) {
933: $join->setPreviousJoin($previousJoin);
934: }
935:
936: // add the ModelJoin to the current object
937: if ($relationAlias) {
938: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
939: $this->addJoinObject($join, $relationAlias);
940: } else {
941: $this->addJoinObject($join, 'Folder');
942: }
943:
944: return $this;
945: }
946:
947: /**
948: * Use the Folder relation Folder object
949: *
950: * @see useQuery()
951: *
952: * @param string $relationAlias optional alias for the relation,
953: * to be used as main alias in the secondary query
954: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
955: *
956: * @return \Thelia\Model\FolderQuery A secondary query class using the current class as primary query
957: */
958: public function useFolderQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
959: {
960: return $this
961: ->joinFolder($relationAlias, $joinType)
962: ->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery');
963: }
964:
965: /**
966: * Filter the query by a related ImageI18n object
967: *
968: * @param ImageI18n|PropelObjectCollection $imageI18n the related object to use as filter
969: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
970: *
971: * @return ImageQuery The current query, for fluid interface
972: * @throws PropelException - if the provided filter is invalid.
973: */
974: public function filterByImageI18n($imageI18n, $comparison = null)
975: {
976: if ($imageI18n instanceof ImageI18n) {
977: return $this
978: ->addUsingAlias(ImagePeer::ID, $imageI18n->getId(), $comparison);
979: } elseif ($imageI18n instanceof PropelObjectCollection) {
980: return $this
981: ->useImageI18nQuery()
982: ->filterByPrimaryKeys($imageI18n->getPrimaryKeys())
983: ->endUse();
984: } else {
985: throw new PropelException('filterByImageI18n() only accepts arguments of type ImageI18n or PropelCollection');
986: }
987: }
988:
989: /**
990: * Adds a JOIN clause to the query using the ImageI18n relation
991: *
992: * @param string $relationAlias optional alias for the relation
993: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
994: *
995: * @return ImageQuery The current query, for fluid interface
996: */
997: public function joinImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
998: {
999: $tableMap = $this->getTableMap();
1000: $relationMap = $tableMap->getRelation('ImageI18n');
1001:
1002: // create a ModelJoin object for this join
1003: $join = new ModelJoin();
1004: $join->setJoinType($joinType);
1005: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
1006: if ($previousJoin = $this->getPreviousJoin()) {
1007: $join->setPreviousJoin($previousJoin);
1008: }
1009:
1010: // add the ModelJoin to the current object
1011: if ($relationAlias) {
1012: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
1013: $this->addJoinObject($join, $relationAlias);
1014: } else {
1015: $this->addJoinObject($join, 'ImageI18n');
1016: }
1017:
1018: return $this;
1019: }
1020:
1021: /**
1022: * Use the ImageI18n relation ImageI18n object
1023: *
1024: * @see useQuery()
1025: *
1026: * @param string $relationAlias optional alias for the relation,
1027: * to be used as main alias in the secondary query
1028: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
1029: *
1030: * @return \Thelia\Model\ImageI18nQuery A secondary query class using the current class as primary query
1031: */
1032: public function useImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
1033: {
1034: return $this
1035: ->joinImageI18n($relationAlias, $joinType)
1036: ->useQuery($relationAlias ? $relationAlias : 'ImageI18n', '\Thelia\Model\ImageI18nQuery');
1037: }
1038:
1039: /**
1040: * Exclude object from result
1041: *
1042: * @param Image $image Object to remove from the list of results
1043: *
1044: * @return ImageQuery The current query, for fluid interface
1045: */
1046: public function prune($image = null)
1047: {
1048: if ($image) {
1049: $this->addUsingAlias(ImagePeer::ID, $image->getId(), Criteria::NOT_EQUAL);
1050: }
1051:
1052: return $this;
1053: }
1054:
1055: // timestampable behavior
1056:
1057: /**
1058: * Filter by the latest updated
1059: *
1060: * @param int $nbDays Maximum age of the latest update in days
1061: *
1062: * @return ImageQuery The current query, for fluid interface
1063: */
1064: public function recentlyUpdated($nbDays = 7)
1065: {
1066: return $this->addUsingAlias(ImagePeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1067: }
1068:
1069: /**
1070: * Order by update date desc
1071: *
1072: * @return ImageQuery The current query, for fluid interface
1073: */
1074: public function lastUpdatedFirst()
1075: {
1076: return $this->addDescendingOrderByColumn(ImagePeer::UPDATED_AT);
1077: }
1078:
1079: /**
1080: * Order by update date asc
1081: *
1082: * @return ImageQuery The current query, for fluid interface
1083: */
1084: public function firstUpdatedFirst()
1085: {
1086: return $this->addAscendingOrderByColumn(ImagePeer::UPDATED_AT);
1087: }
1088:
1089: /**
1090: * Filter by the latest created
1091: *
1092: * @param int $nbDays Maximum age of in days
1093: *
1094: * @return ImageQuery The current query, for fluid interface
1095: */
1096: public function recentlyCreated($nbDays = 7)
1097: {
1098: return $this->addUsingAlias(ImagePeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
1099: }
1100:
1101: /**
1102: * Order by create date desc
1103: *
1104: * @return ImageQuery The current query, for fluid interface
1105: */
1106: public function lastCreatedFirst()
1107: {
1108: return $this->addDescendingOrderByColumn(ImagePeer::CREATED_AT);
1109: }
1110:
1111: /**
1112: * Order by create date asc
1113: *
1114: * @return ImageQuery The current query, for fluid interface
1115: */
1116: public function firstCreatedFirst()
1117: {
1118: return $this->addAscendingOrderByColumn(ImagePeer::CREATED_AT);
1119: }
1120: // i18n behavior
1121:
1122: /**
1123: * Adds a JOIN clause to the query using the i18n relation
1124: *
1125: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
1126: * @param string $relationAlias optional alias for the relation
1127: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
1128: *
1129: * @return ImageQuery The current query, for fluid interface
1130: */
1131: public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1132: {
1133: $relationName = $relationAlias ? $relationAlias : 'ImageI18n';
1134:
1135: return $this
1136: ->joinImageI18n($relationAlias, $joinType)
1137: ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
1138: }
1139:
1140: /**
1141: * Adds a JOIN clause to the query and hydrates the related I18n object.
1142: * Shortcut for $c->joinI18n($locale)->with()
1143: *
1144: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
1145: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
1146: *
1147: * @return ImageQuery The current query, for fluid interface
1148: */
1149: public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
1150: {
1151: $this
1152: ->joinI18n($locale, null, $joinType)
1153: ->with('ImageI18n');
1154: $this->with['ImageI18n']->setIsWithOneToMany(false);
1155:
1156: return $this;
1157: }
1158:
1159: /**
1160: * Use the I18n relation query object
1161: *
1162: * @see useQuery()
1163: *
1164: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
1165: * @param string $relationAlias optional alias for the relation
1166: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
1167: *
1168: * @return ImageI18nQuery A secondary query class using the current class as primary query
1169: */
1170: public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
1171: {
1172: return $this
1173: ->joinI18n($locale, $relationAlias, $joinType)
1174: ->useQuery($relationAlias ? $relationAlias : 'ImageI18n', 'Thelia\Model\ImageI18nQuery');
1175: }
1176:
1177: }
1178: