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 findOneById(int $id) Return the first CustomerTitle filtered by the id column
59: * @method CustomerTitle findOneByByDefault(int $by_default) Return the first CustomerTitle filtered by the by_default column
60: * @method CustomerTitle findOneByPosition(string $position) Return the first CustomerTitle filtered by the position column
61: * @method CustomerTitle findOneByCreatedAt(string $created_at) Return the first CustomerTitle filtered by the created_at column
62: * @method CustomerTitle findOneByUpdatedAt(string $updated_at) Return the first CustomerTitle filtered by the updated_at column
63: *
64: * @method array findById(int $id) Return CustomerTitle objects filtered by the id column
65: * @method array findByByDefault(int $by_default) Return CustomerTitle objects filtered by the by_default column
66: * @method array findByPosition(string $position) Return CustomerTitle objects filtered by the position column
67: * @method array findByCreatedAt(string $created_at) Return CustomerTitle objects filtered by the created_at column
68: * @method array findByUpdatedAt(string $updated_at) Return CustomerTitle objects filtered by the updated_at column
69: *
70: * @package propel.generator.Thelia.Model.om
71: */
72: abstract class BaseCustomerTitleQuery extends ModelCriteria
73: {
74: /**
75: * Initializes internal state of BaseCustomerTitleQuery 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\\CustomerTitle', $modelAlias = null)
82: {
83: parent::__construct($dbName, $modelName, $modelAlias);
84: }
85:
86: /**
87: * Returns a new CustomerTitleQuery object.
88: *
89: * @param string $modelAlias The alias of a model in the query
90: * @param CustomerTitleQuery|Criteria $criteria Optional Criteria to build the query from
91: *
92: * @return CustomerTitleQuery
93: */
94: public static function create($modelAlias = null, $criteria = null)
95: {
96: if ($criteria instanceof CustomerTitleQuery) {
97: return $criteria;
98: }
99: $query = new CustomerTitleQuery();
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 CustomerTitle|CustomerTitle[]|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 = CustomerTitlePeer::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(CustomerTitlePeer::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 CustomerTitle 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`, `BY_DEFAULT`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `customer_title` 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 CustomerTitle();
170: $obj->hydrate($row);
171: CustomerTitlePeer::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 CustomerTitle|CustomerTitle[]|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|CustomerTitle[]|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 CustomerTitleQuery The current query, for fluid interface
227: */
228: public function filterByPrimaryKey($key)
229: {
230:
231: return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery The current query, for fluid interface
240: */
241: public function filterByPrimaryKeys($keys)
242: {
243:
244: return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery 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(CustomerTitlePeer::ID, $id, $comparison);
272: }
273:
274: /**
275: * Filter the query on the by_default column
276: *
277: * Example usage:
278: * <code>
279: * $query->filterByByDefault(1234); // WHERE by_default = 1234
280: * $query->filterByByDefault(array(12, 34)); // WHERE by_default IN (12, 34)
281: * $query->filterByByDefault(array('min' => 12)); // WHERE by_default > 12
282: * </code>
283: *
284: * @param mixed $byDefault The value to use as filter.
285: * Use scalar values for equality.
286: * Use array values for in_array() equivalent.
287: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
288: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
289: *
290: * @return CustomerTitleQuery The current query, for fluid interface
291: */
292: public function filterByByDefault($byDefault = null, $comparison = null)
293: {
294: if (is_array($byDefault)) {
295: $useMinMax = false;
296: if (isset($byDefault['min'])) {
297: $this->addUsingAlias(CustomerTitlePeer::BY_DEFAULT, $byDefault['min'], Criteria::GREATER_EQUAL);
298: $useMinMax = true;
299: }
300: if (isset($byDefault['max'])) {
301: $this->addUsingAlias(CustomerTitlePeer::BY_DEFAULT, $byDefault['max'], Criteria::LESS_EQUAL);
302: $useMinMax = true;
303: }
304: if ($useMinMax) {
305: return $this;
306: }
307: if (null === $comparison) {
308: $comparison = Criteria::IN;
309: }
310: }
311:
312: return $this->addUsingAlias(CustomerTitlePeer::BY_DEFAULT, $byDefault, $comparison);
313: }
314:
315: /**
316: * Filter the query on the position column
317: *
318: * Example usage:
319: * <code>
320: * $query->filterByPosition('fooValue'); // WHERE position = 'fooValue'
321: * $query->filterByPosition('%fooValue%'); // WHERE position LIKE '%fooValue%'
322: * </code>
323: *
324: * @param string $position The value to use as filter.
325: * Accepts wildcards (* and % trigger a LIKE)
326: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
327: *
328: * @return CustomerTitleQuery The current query, for fluid interface
329: */
330: public function filterByPosition($position = null, $comparison = null)
331: {
332: if (null === $comparison) {
333: if (is_array($position)) {
334: $comparison = Criteria::IN;
335: } elseif (preg_match('/[\%\*]/', $position)) {
336: $position = str_replace('*', '%', $position);
337: $comparison = Criteria::LIKE;
338: }
339: }
340:
341: return $this->addUsingAlias(CustomerTitlePeer::POSITION, $position, $comparison);
342: }
343:
344: /**
345: * Filter the query on the created_at column
346: *
347: * Example usage:
348: * <code>
349: * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
350: * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
351: * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
352: * </code>
353: *
354: * @param mixed $createdAt The value to use as filter.
355: * Values can be integers (unix timestamps), DateTime objects, or strings.
356: * Empty strings are treated as NULL.
357: * Use scalar values for equality.
358: * Use array values for in_array() equivalent.
359: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
360: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
361: *
362: * @return CustomerTitleQuery The current query, for fluid interface
363: */
364: public function filterByCreatedAt($createdAt = null, $comparison = null)
365: {
366: if (is_array($createdAt)) {
367: $useMinMax = false;
368: if (isset($createdAt['min'])) {
369: $this->addUsingAlias(CustomerTitlePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
370: $useMinMax = true;
371: }
372: if (isset($createdAt['max'])) {
373: $this->addUsingAlias(CustomerTitlePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
374: $useMinMax = true;
375: }
376: if ($useMinMax) {
377: return $this;
378: }
379: if (null === $comparison) {
380: $comparison = Criteria::IN;
381: }
382: }
383:
384: return $this->addUsingAlias(CustomerTitlePeer::CREATED_AT, $createdAt, $comparison);
385: }
386:
387: /**
388: * Filter the query on the updated_at column
389: *
390: * Example usage:
391: * <code>
392: * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
393: * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
394: * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
395: * </code>
396: *
397: * @param mixed $updatedAt The value to use as filter.
398: * Values can be integers (unix timestamps), DateTime objects, or strings.
399: * Empty strings are treated as NULL.
400: * Use scalar values for equality.
401: * Use array values for in_array() equivalent.
402: * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
403: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
404: *
405: * @return CustomerTitleQuery The current query, for fluid interface
406: */
407: public function filterByUpdatedAt($updatedAt = null, $comparison = null)
408: {
409: if (is_array($updatedAt)) {
410: $useMinMax = false;
411: if (isset($updatedAt['min'])) {
412: $this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
413: $useMinMax = true;
414: }
415: if (isset($updatedAt['max'])) {
416: $this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
417: $useMinMax = true;
418: }
419: if ($useMinMax) {
420: return $this;
421: }
422: if (null === $comparison) {
423: $comparison = Criteria::IN;
424: }
425: }
426:
427: return $this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, $updatedAt, $comparison);
428: }
429:
430: /**
431: * Filter the query by a related Customer object
432: *
433: * @param Customer|PropelObjectCollection $customer the related object to use as filter
434: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
435: *
436: * @return CustomerTitleQuery The current query, for fluid interface
437: * @throws PropelException - if the provided filter is invalid.
438: */
439: public function filterByCustomer($customer, $comparison = null)
440: {
441: if ($customer instanceof Customer) {
442: return $this
443: ->addUsingAlias(CustomerTitlePeer::ID, $customer->getCustomerTitleId(), $comparison);
444: } elseif ($customer instanceof PropelObjectCollection) {
445: return $this
446: ->useCustomerQuery()
447: ->filterByPrimaryKeys($customer->getPrimaryKeys())
448: ->endUse();
449: } else {
450: throw new PropelException('filterByCustomer() only accepts arguments of type Customer or PropelCollection');
451: }
452: }
453:
454: /**
455: * Adds a JOIN clause to the query using the Customer relation
456: *
457: * @param string $relationAlias optional alias for the relation
458: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
459: *
460: * @return CustomerTitleQuery The current query, for fluid interface
461: */
462: public function joinCustomer($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
463: {
464: $tableMap = $this->getTableMap();
465: $relationMap = $tableMap->getRelation('Customer');
466:
467: // create a ModelJoin object for this join
468: $join = new ModelJoin();
469: $join->setJoinType($joinType);
470: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
471: if ($previousJoin = $this->getPreviousJoin()) {
472: $join->setPreviousJoin($previousJoin);
473: }
474:
475: // add the ModelJoin to the current object
476: if ($relationAlias) {
477: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
478: $this->addJoinObject($join, $relationAlias);
479: } else {
480: $this->addJoinObject($join, 'Customer');
481: }
482:
483: return $this;
484: }
485:
486: /**
487: * Use the Customer relation Customer object
488: *
489: * @see useQuery()
490: *
491: * @param string $relationAlias optional alias for the relation,
492: * to be used as main alias in the secondary query
493: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
494: *
495: * @return \Thelia\Model\CustomerQuery A secondary query class using the current class as primary query
496: */
497: public function useCustomerQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
498: {
499: return $this
500: ->joinCustomer($relationAlias, $joinType)
501: ->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
502: }
503:
504: /**
505: * Filter the query by a related Address object
506: *
507: * @param Address|PropelObjectCollection $address the related object to use as filter
508: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
509: *
510: * @return CustomerTitleQuery The current query, for fluid interface
511: * @throws PropelException - if the provided filter is invalid.
512: */
513: public function filterByAddress($address, $comparison = null)
514: {
515: if ($address instanceof Address) {
516: return $this
517: ->addUsingAlias(CustomerTitlePeer::ID, $address->getCustomerTitleId(), $comparison);
518: } elseif ($address instanceof PropelObjectCollection) {
519: return $this
520: ->useAddressQuery()
521: ->filterByPrimaryKeys($address->getPrimaryKeys())
522: ->endUse();
523: } else {
524: throw new PropelException('filterByAddress() only accepts arguments of type Address or PropelCollection');
525: }
526: }
527:
528: /**
529: * Adds a JOIN clause to the query using the Address relation
530: *
531: * @param string $relationAlias optional alias for the relation
532: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
533: *
534: * @return CustomerTitleQuery The current query, for fluid interface
535: */
536: public function joinAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
537: {
538: $tableMap = $this->getTableMap();
539: $relationMap = $tableMap->getRelation('Address');
540:
541: // create a ModelJoin object for this join
542: $join = new ModelJoin();
543: $join->setJoinType($joinType);
544: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
545: if ($previousJoin = $this->getPreviousJoin()) {
546: $join->setPreviousJoin($previousJoin);
547: }
548:
549: // add the ModelJoin to the current object
550: if ($relationAlias) {
551: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
552: $this->addJoinObject($join, $relationAlias);
553: } else {
554: $this->addJoinObject($join, 'Address');
555: }
556:
557: return $this;
558: }
559:
560: /**
561: * Use the Address relation Address object
562: *
563: * @see useQuery()
564: *
565: * @param string $relationAlias optional alias for the relation,
566: * to be used as main alias in the secondary query
567: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
568: *
569: * @return \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
570: */
571: public function useAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
572: {
573: return $this
574: ->joinAddress($relationAlias, $joinType)
575: ->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
576: }
577:
578: /**
579: * Filter the query by a related CustomerTitleI18n object
580: *
581: * @param CustomerTitleI18n|PropelObjectCollection $customerTitleI18n the related object to use as filter
582: * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
583: *
584: * @return CustomerTitleQuery The current query, for fluid interface
585: * @throws PropelException - if the provided filter is invalid.
586: */
587: public function filterByCustomerTitleI18n($customerTitleI18n, $comparison = null)
588: {
589: if ($customerTitleI18n instanceof CustomerTitleI18n) {
590: return $this
591: ->addUsingAlias(CustomerTitlePeer::ID, $customerTitleI18n->getId(), $comparison);
592: } elseif ($customerTitleI18n instanceof PropelObjectCollection) {
593: return $this
594: ->useCustomerTitleI18nQuery()
595: ->filterByPrimaryKeys($customerTitleI18n->getPrimaryKeys())
596: ->endUse();
597: } else {
598: throw new PropelException('filterByCustomerTitleI18n() only accepts arguments of type CustomerTitleI18n or PropelCollection');
599: }
600: }
601:
602: /**
603: * Adds a JOIN clause to the query using the CustomerTitleI18n relation
604: *
605: * @param string $relationAlias optional alias for the relation
606: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
607: *
608: * @return CustomerTitleQuery The current query, for fluid interface
609: */
610: public function joinCustomerTitleI18n($relationAlias = null, $joinType = 'LEFT JOIN')
611: {
612: $tableMap = $this->getTableMap();
613: $relationMap = $tableMap->getRelation('CustomerTitleI18n');
614:
615: // create a ModelJoin object for this join
616: $join = new ModelJoin();
617: $join->setJoinType($joinType);
618: $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
619: if ($previousJoin = $this->getPreviousJoin()) {
620: $join->setPreviousJoin($previousJoin);
621: }
622:
623: // add the ModelJoin to the current object
624: if ($relationAlias) {
625: $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
626: $this->addJoinObject($join, $relationAlias);
627: } else {
628: $this->addJoinObject($join, 'CustomerTitleI18n');
629: }
630:
631: return $this;
632: }
633:
634: /**
635: * Use the CustomerTitleI18n relation CustomerTitleI18n object
636: *
637: * @see useQuery()
638: *
639: * @param string $relationAlias optional alias for the relation,
640: * to be used as main alias in the secondary query
641: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
642: *
643: * @return \Thelia\Model\CustomerTitleI18nQuery A secondary query class using the current class as primary query
644: */
645: public function useCustomerTitleI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
646: {
647: return $this
648: ->joinCustomerTitleI18n($relationAlias, $joinType)
649: ->useQuery($relationAlias ? $relationAlias : 'CustomerTitleI18n', '\Thelia\Model\CustomerTitleI18nQuery');
650: }
651:
652: /**
653: * Exclude object from result
654: *
655: * @param CustomerTitle $customerTitle Object to remove from the list of results
656: *
657: * @return CustomerTitleQuery The current query, for fluid interface
658: */
659: public function prune($customerTitle = null)
660: {
661: if ($customerTitle) {
662: $this->addUsingAlias(CustomerTitlePeer::ID, $customerTitle->getId(), Criteria::NOT_EQUAL);
663: }
664:
665: return $this;
666: }
667:
668: // timestampable behavior
669:
670: /**
671: * Filter by the latest updated
672: *
673: * @param int $nbDays Maximum age of the latest update in days
674: *
675: * @return CustomerTitleQuery The current query, for fluid interface
676: */
677: public function recentlyUpdated($nbDays = 7)
678: {
679: return $this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
680: }
681:
682: /**
683: * Order by update date desc
684: *
685: * @return CustomerTitleQuery The current query, for fluid interface
686: */
687: public function lastUpdatedFirst()
688: {
689: return $this->addDescendingOrderByColumn(CustomerTitlePeer::UPDATED_AT);
690: }
691:
692: /**
693: * Order by update date asc
694: *
695: * @return CustomerTitleQuery The current query, for fluid interface
696: */
697: public function firstUpdatedFirst()
698: {
699: return $this->addAscendingOrderByColumn(CustomerTitlePeer::UPDATED_AT);
700: }
701:
702: /**
703: * Filter by the latest created
704: *
705: * @param int $nbDays Maximum age of in days
706: *
707: * @return CustomerTitleQuery The current query, for fluid interface
708: */
709: public function recentlyCreated($nbDays = 7)
710: {
711: return $this->addUsingAlias(CustomerTitlePeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
712: }
713:
714: /**
715: * Order by create date desc
716: *
717: * @return CustomerTitleQuery The current query, for fluid interface
718: */
719: public function lastCreatedFirst()
720: {
721: return $this->addDescendingOrderByColumn(CustomerTitlePeer::CREATED_AT);
722: }
723:
724: /**
725: * Order by create date asc
726: *
727: * @return CustomerTitleQuery The current query, for fluid interface
728: */
729: public function firstCreatedFirst()
730: {
731: return $this->addAscendingOrderByColumn(CustomerTitlePeer::CREATED_AT);
732: }
733: // i18n behavior
734:
735: /**
736: * Adds a JOIN clause to the query using the i18n relation
737: *
738: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
739: * @param string $relationAlias optional alias for the relation
740: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
741: *
742: * @return CustomerTitleQuery The current query, for fluid interface
743: */
744: public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
745: {
746: $relationName = $relationAlias ? $relationAlias : 'CustomerTitleI18n';
747:
748: return $this
749: ->joinCustomerTitleI18n($relationAlias, $joinType)
750: ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
751: }
752:
753: /**
754: * Adds a JOIN clause to the query and hydrates the related I18n object.
755: * Shortcut for $c->joinI18n($locale)->with()
756: *
757: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
758: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
759: *
760: * @return CustomerTitleQuery The current query, for fluid interface
761: */
762: public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
763: {
764: $this
765: ->joinI18n($locale, null, $joinType)
766: ->with('CustomerTitleI18n');
767: $this->with['CustomerTitleI18n']->setIsWithOneToMany(false);
768:
769: return $this;
770: }
771:
772: /**
773: * Use the I18n relation query object
774: *
775: * @see useQuery()
776: *
777: * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
778: * @param string $relationAlias optional alias for the relation
779: * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
780: *
781: * @return CustomerTitleI18nQuery A secondary query class using the current class as primary query
782: */
783: public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
784: {
785: return $this
786: ->joinI18n($locale, $relationAlias, $joinType)
787: ->useQuery($relationAlias ? $relationAlias : 'CustomerTitleI18n', 'Thelia\Model\CustomerTitleI18nQuery');
788: }
789:
790: }
791: