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