# File core/lib/Thelia/Model/om/BaseCustomerQuery.php | thelia

       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\CustomerPeer;
      18: use Thelia\Model\CustomerQuery;
      19: use Thelia\Model\CustomerTitle;
      20: use Thelia\Model\Order;
      21:
      22: /**
      23:  * Base class that represents a query for the 'customer' table.
      24:  *
      25:  *
      26:  *
      27:  * @method CustomerQuery orderById($order = Criteria::ASC) Order by the id column
      28:  * @method CustomerQuery orderByRef($order = Criteria::ASC) Order by the ref column
      29:  * @method CustomerQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
      30:  * @method CustomerQuery orderByCompany($order = Criteria::ASC) Order by the company column
      31:  * @method CustomerQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
      32:  * @method CustomerQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
      33:  * @method CustomerQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
      34:  * @method CustomerQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
      35:  * @method CustomerQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
      36:  * @method CustomerQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
      37:  * @method CustomerQuery orderByCity($order = Criteria::ASC) Order by the city column
      38:  * @method CustomerQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
      39:  * @method CustomerQuery orderByPhone($order = Criteria::ASC) Order by the phone column
      40:  * @method CustomerQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column
      41:  * @method CustomerQuery orderByEmail($order = Criteria::ASC) Order by the email column
      42:  * @method CustomerQuery orderByPassword($order = Criteria::ASC) Order by the password column
      43:  * @method CustomerQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
      44:  * @method CustomerQuery orderBySalt($order = Criteria::ASC) Order by the salt column
      45:  * @method CustomerQuery orderByReseller($order = Criteria::ASC) Order by the reseller column
      46:  * @method CustomerQuery orderByLang($order = Criteria::ASC) Order by the lang column
      47:  * @method CustomerQuery orderBySponsor($order = Criteria::ASC) Order by the sponsor column
      48:  * @method CustomerQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
      49:  * @method CustomerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
      50:  * @method CustomerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
      51:  *
      52:  * @method CustomerQuery groupById() Group by the id column
      53:  * @method CustomerQuery groupByRef() Group by the ref column
      54:  * @method CustomerQuery groupByCustomerTitleId() Group by the customer_title_id column
      55:  * @method CustomerQuery groupByCompany() Group by the company column
      56:  * @method CustomerQuery groupByFirstname() Group by the firstname column
      57:  * @method CustomerQuery groupByLastname() Group by the lastname column
      58:  * @method CustomerQuery groupByAddress1() Group by the address1 column
      59:  * @method CustomerQuery groupByAddress2() Group by the address2 column
      60:  * @method CustomerQuery groupByAddress3() Group by the address3 column
      61:  * @method CustomerQuery groupByZipcode() Group by the zipcode column
      62:  * @method CustomerQuery groupByCity() Group by the city column
      63:  * @method CustomerQuery groupByCountryId() Group by the country_id column
      64:  * @method CustomerQuery groupByPhone() Group by the phone column
      65:  * @method CustomerQuery groupByCellphone() Group by the cellphone column
      66:  * @method CustomerQuery groupByEmail() Group by the email column
      67:  * @method CustomerQuery groupByPassword() Group by the password column
      68:  * @method CustomerQuery groupByAlgo() Group by the algo column
      69:  * @method CustomerQuery groupBySalt() Group by the salt column
      70:  * @method CustomerQuery groupByReseller() Group by the reseller column
      71:  * @method CustomerQuery groupByLang() Group by the lang column
      72:  * @method CustomerQuery groupBySponsor() Group by the sponsor column
      73:  * @method CustomerQuery groupByDiscount() Group by the discount column
      74:  * @method CustomerQuery groupByCreatedAt() Group by the created_at column
      75:  * @method CustomerQuery groupByUpdatedAt() Group by the updated_at column
      76:  *
      77:  * @method CustomerQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
      78:  * @method CustomerQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
      79:  * @method CustomerQuery innerJoin($relation) Adds a INNER JOIN clause to the query
      80:  *
      81:  * @method CustomerQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
      82:  * @method CustomerQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
      83:  * @method CustomerQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
      84:  *
      85:  * @method CustomerQuery leftJoinAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the Address relation
      86:  * @method CustomerQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
      87:  * @method CustomerQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
      88:  *
      89:  * @method CustomerQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
      90:  * @method CustomerQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
      91:  * @method CustomerQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
      92:  *
      93:  * @method Customer findOne(PropelPDO $con = null) Return the first Customer matching the query
      94:  * @method Customer findOneOrCreate(PropelPDO $con = null) Return the first Customer matching the query, or a new Customer object populated from the query conditions when no match is found
      95:  *
      96:  * @method Customer findOneById(int $id) Return the first Customer filtered by the id column
      97:  * @method Customer findOneByRef(string $ref) Return the first Customer filtered by the ref column
      98:  * @method Customer findOneByCustomerTitleId(int $customer_title_id) Return the first Customer filtered by the customer_title_id column
      99:  * @method Customer findOneByCompany(string $company) Return the first Customer filtered by the company column
     100:  * @method Customer findOneByFirstname(string $firstname) Return the first Customer filtered by the firstname column
     101:  * @method Customer findOneByLastname(string $lastname) Return the first Customer filtered by the lastname column
     102:  * @method Customer findOneByAddress1(string $address1) Return the first Customer filtered by the address1 column
     103:  * @method Customer findOneByAddress2(string $address2) Return the first Customer filtered by the address2 column
     104:  * @method Customer findOneByAddress3(string $address3) Return the first Customer filtered by the address3 column
     105:  * @method Customer findOneByZipcode(string $zipcode) Return the first Customer filtered by the zipcode column
     106:  * @method Customer findOneByCity(string $city) Return the first Customer filtered by the city column
     107:  * @method Customer findOneByCountryId(int $country_id) Return the first Customer filtered by the country_id column
     108:  * @method Customer findOneByPhone(string $phone) Return the first Customer filtered by the phone column
     109:  * @method Customer findOneByCellphone(string $cellphone) Return the first Customer filtered by the cellphone column
     110:  * @method Customer findOneByEmail(string $email) Return the first Customer filtered by the email column
     111:  * @method Customer findOneByPassword(string $password) Return the first Customer filtered by the password column
     112:  * @method Customer findOneByAlgo(string $algo) Return the first Customer filtered by the algo column
     113:  * @method Customer findOneBySalt(string $salt) Return the first Customer filtered by the salt column
     114:  * @method Customer findOneByReseller(int $reseller) Return the first Customer filtered by the reseller column
     115:  * @method Customer findOneByLang(string $lang) Return the first Customer filtered by the lang column
     116:  * @method Customer findOneBySponsor(string $sponsor) Return the first Customer filtered by the sponsor column
     117:  * @method Customer findOneByDiscount(double $discount) Return the first Customer filtered by the discount column
     118:  * @method Customer findOneByCreatedAt(string $created_at) Return the first Customer filtered by the created_at column
     119:  * @method Customer findOneByUpdatedAt(string $updated_at) Return the first Customer filtered by the updated_at column
     120:  *
     121:  * @method array findById(int $id) Return Customer objects filtered by the id column
     122:  * @method array findByRef(string $ref) Return Customer objects filtered by the ref column
     123:  * @method array findByCustomerTitleId(int $customer_title_id) Return Customer objects filtered by the customer_title_id column
     124:  * @method array findByCompany(string $company) Return Customer objects filtered by the company column
     125:  * @method array findByFirstname(string $firstname) Return Customer objects filtered by the firstname column
     126:  * @method array findByLastname(string $lastname) Return Customer objects filtered by the lastname column
     127:  * @method array findByAddress1(string $address1) Return Customer objects filtered by the address1 column
     128:  * @method array findByAddress2(string $address2) Return Customer objects filtered by the address2 column
     129:  * @method array findByAddress3(string $address3) Return Customer objects filtered by the address3 column
     130:  * @method array findByZipcode(string $zipcode) Return Customer objects filtered by the zipcode column
     131:  * @method array findByCity(string $city) Return Customer objects filtered by the city column
     132:  * @method array findByCountryId(int $country_id) Return Customer objects filtered by the country_id column
     133:  * @method array findByPhone(string $phone) Return Customer objects filtered by the phone column
     134:  * @method array findByCellphone(string $cellphone) Return Customer objects filtered by the cellphone column
     135:  * @method array findByEmail(string $email) Return Customer objects filtered by the email column
     136:  * @method array findByPassword(string $password) Return Customer objects filtered by the password column
     137:  * @method array findByAlgo(string $algo) Return Customer objects filtered by the algo column
     138:  * @method array findBySalt(string $salt) Return Customer objects filtered by the salt column
     139:  * @method array findByReseller(int $reseller) Return Customer objects filtered by the reseller column
     140:  * @method array findByLang(string $lang) Return Customer objects filtered by the lang column
     141:  * @method array findBySponsor(string $sponsor) Return Customer objects filtered by the sponsor column
     142:  * @method array findByDiscount(double $discount) Return Customer objects filtered by the discount column
     143:  * @method array findByCreatedAt(string $created_at) Return Customer objects filtered by the created_at column
     144:  * @method array findByUpdatedAt(string $updated_at) Return Customer objects filtered by the updated_at column
     145:  *
     146:  * @package    propel.generator.Thelia.Model.om
     147:  */
     148: abstract class BaseCustomerQuery extends ModelCriteria
     149: {
     150:     /**
     151:      * Initializes internal state of BaseCustomerQuery object.
     152:      *
     153:      * @param     string $dbName The dabase name
     154:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     155:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     156:      */
     157:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Customer', $modelAlias = null)
     158:     {
     159:         parent::__construct($dbName, $modelName, $modelAlias);
     160:     }
     161:
     162:     /**
     163:      * Returns a new CustomerQuery object.
     164:      *
     165:      * @param     string $modelAlias The alias of a model in the query
     166:      * @param     CustomerQuery|Criteria $criteria Optional Criteria to build the query from
     167:      *
     168:      * @return CustomerQuery
     169:      */
     170:     public static function create($modelAlias = null, $criteria = null)
     171:     {
     172:         if ($criteria instanceof CustomerQuery) {
     173:             return $criteria;
     174:         }
     175:         $query = new CustomerQuery();
     176:         if (null !== $modelAlias) {
     177:             $query->setModelAlias($modelAlias);
     178:         }
     179:         if ($criteria instanceof Criteria) {
     180:             $query->mergeWith($criteria);
     181:         }
     182:
     183:         return $query;
     184:     }
     185:
     186:     /**
     187:      * Find object by primary key.
     188:      * Propel uses the instance pool to skip the database if the object exists.
     189:      * Go fast if the query is untouched.
     190:      *
     191:      * <code>
     192:      * $obj  = $c->findPk(12, $con);
     193:      * </code>
     194:      *
     195:      * @param mixed $key Primary key to use for the query
     196:      * @param     PropelPDO $con an optional connection object
     197:      *
     198:      * @return   Customer|Customer[]|mixed the result, formatted by the current formatter
     199:      */
     200:     public function findPk($key, $con = null)
     201:     {
     202:         if ($key === null) {
     203:             return null;
     204:         }
     205:         if ((null !== ($obj = CustomerPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
     206:             // the object is alredy in the instance pool
     207:             return $obj;
     208:         }
     209:         if ($con === null) {
     210:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     211:         }
     212:         $this->basePreSelect($con);
     213:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
     214:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
     215:          || $this->map || $this->having || $this->joins) {
     216:             return $this->findPkComplex($key, $con);
     217:         } else {
     218:             return $this->findPkSimple($key, $con);
     219:         }
     220:     }
     221:
     222:     /**
     223:      * Find object by primary key using raw SQL to go fast.
     224:      * Bypass doSelect() and the object formatter by using generated code.
     225:      *
     226:      * @param     mixed $key Primary key to use for the query
     227:      * @param     PropelPDO $con A connection object
     228:      *
     229:      * @return   Customer A model object, or null if the key is not found
     230:      * @throws   PropelException
     231:      */
     232:     protected function findPkSimple($key, $con)
     233:     {
     234:         $sql = 'SELECT `ID`, `REF`, `CUSTOMER_TITLE_ID`, `COMPANY`, `FIRSTNAME`, `LASTNAME`, `ADDRESS1`, `ADDRESS2`, `ADDRESS3`, `ZIPCODE`, `CITY`, `COUNTRY_ID`, `PHONE`, `CELLPHONE`, `EMAIL`, `PASSWORD`, `ALGO`, `SALT`, `RESELLER`, `LANG`, `SPONSOR`, `DISCOUNT`, `CREATED_AT`, `UPDATED_AT` FROM `customer` WHERE `ID` = :p0';
     235:         try {
     236:             $stmt = $con->prepare($sql);
     237:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
     238:             $stmt->execute();
     239:         } catch (Exception $e) {
     240:             Propel::log($e->getMessage(), Propel::LOG_ERR);
     241:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     242:         }
     243:         $obj = null;
     244:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     245:             $obj = new Customer();
     246:             $obj->hydrate($row);
     247:             CustomerPeer::addInstanceToPool($obj, (string) $key);
     248:         }
     249:         $stmt->closeCursor();
     250:
     251:         return $obj;
     252:     }
     253:
     254:     /**
     255:      * Find object by primary key.
     256:      *
     257:      * @param     mixed $key Primary key to use for the query
     258:      * @param     PropelPDO $con A connection object
     259:      *
     260:      * @return Customer|Customer[]|mixed the result, formatted by the current formatter
     261:      */
     262:     protected function findPkComplex($key, $con)
     263:     {
     264:         // As the query uses a PK condition, no limit(1) is necessary.
     265:         $criteria = $this->isKeepQuery() ? clone $this : $this;
     266:         $stmt = $criteria
     267:             ->filterByPrimaryKey($key)
     268:             ->doSelect($con);
     269:
     270:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
     271:     }
     272:
     273:     /**
     274:      * Find objects by primary key
     275:      * <code>
     276:      * $objs = $c->findPks(array(12, 56, 832), $con);
     277:      * </code>
     278:      * @param     array $keys Primary keys to use for the query
     279:      * @param     PropelPDO $con an optional connection object
     280:      *
     281:      * @return PropelObjectCollection|Customer[]|mixed the list of results, formatted by the current formatter
     282:      */
     283:     public function findPks($keys, $con = null)
     284:     {
     285:         if ($con === null) {
     286:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
     287:         }
     288:         $this->basePreSelect($con);
     289:         $criteria = $this->isKeepQuery() ? clone $this : $this;
     290:         $stmt = $criteria
     291:             ->filterByPrimaryKeys($keys)
     292:             ->doSelect($con);
     293:
     294:         return $criteria->getFormatter()->init($criteria)->format($stmt);
     295:     }
     296:
     297:     /**
     298:      * Filter the query by primary key
     299:      *
     300:      * @param     mixed $key Primary key to use for the query
     301:      *
     302:      * @return CustomerQuery The current query, for fluid interface
     303:      */
     304:     public function filterByPrimaryKey($key)
     305:     {
     306:
     307:         return $this->addUsingAlias(CustomerPeer::ID, $key, Criteria::EQUAL);
     308:     }
     309:
     310:     /**
     311:      * Filter the query by a list of primary keys
     312:      *
     313:      * @param     array $keys The list of primary key to use for the query
     314:      *
     315:      * @return CustomerQuery The current query, for fluid interface
     316:      */
     317:     public function filterByPrimaryKeys($keys)
     318:     {
     319:
     320:         return $this->addUsingAlias(CustomerPeer::ID, $keys, Criteria::IN);
     321:     }
     322:
     323:     /**
     324:      * Filter the query on the id column
     325:      *
     326:      * Example usage:
     327:      * <code>
     328:      * $query->filterById(1234); // WHERE id = 1234
     329:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     330:      * $query->filterById(array('min' => 12)); // WHERE id > 12
     331:      * </code>
     332:      *
     333:      * @param     mixed $id The value to use as filter.
     334:      *              Use scalar values for equality.
     335:      *              Use array values for in_array() equivalent.
     336:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     337:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     338:      *
     339:      * @return CustomerQuery The current query, for fluid interface
     340:      */
     341:     public function filterById($id = null, $comparison = null)
     342:     {
     343:         if (is_array($id) && null === $comparison) {
     344:             $comparison = Criteria::IN;
     345:         }
     346:
     347:         return $this->addUsingAlias(CustomerPeer::ID, $id, $comparison);
     348:     }
     349:
     350:     /**
     351:      * Filter the query on the ref column
     352:      *
     353:      * Example usage:
     354:      * <code>
     355:      * $query->filterByRef('fooValue');   // WHERE ref = 'fooValue'
     356:      * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
     357:      * </code>
     358:      *
     359:      * @param     string $ref The value to use as filter.
     360:      *              Accepts wildcards (* and % trigger a LIKE)
     361:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     362:      *
     363:      * @return CustomerQuery The current query, for fluid interface
     364:      */
     365:     public function filterByRef($ref = null, $comparison = null)
     366:     {
     367:         if (null === $comparison) {
     368:             if (is_array($ref)) {
     369:                 $comparison = Criteria::IN;
     370:             } elseif (preg_match('/[\%\*]/', $ref)) {
     371:                 $ref = str_replace('*', '%', $ref);
     372:                 $comparison = Criteria::LIKE;
     373:             }
     374:         }
     375:
     376:         return $this->addUsingAlias(CustomerPeer::REF, $ref, $comparison);
     377:     }
     378:
     379:     /**
     380:      * Filter the query on the customer_title_id column
     381:      *
     382:      * Example usage:
     383:      * <code>
     384:      * $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
     385:      * $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
     386:      * $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
     387:      * </code>
     388:      *
     389:      * @see       filterByCustomerTitle()
     390:      *
     391:      * @param     mixed $customerTitleId The value to use as filter.
     392:      *              Use scalar values for equality.
     393:      *              Use array values for in_array() equivalent.
     394:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     395:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     396:      *
     397:      * @return CustomerQuery The current query, for fluid interface
     398:      */
     399:     public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
     400:     {
     401:         if (is_array($customerTitleId)) {
     402:             $useMinMax = false;
     403:             if (isset($customerTitleId['min'])) {
     404:                 $this->addUsingAlias(CustomerPeer::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
     405:                 $useMinMax = true;
     406:             }
     407:             if (isset($customerTitleId['max'])) {
     408:                 $this->addUsingAlias(CustomerPeer::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
     409:                 $useMinMax = true;
     410:             }
     411:             if ($useMinMax) {
     412:                 return $this;
     413:             }
     414:             if (null === $comparison) {
     415:                 $comparison = Criteria::IN;
     416:             }
     417:         }
     418:
     419:         return $this->addUsingAlias(CustomerPeer::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
     420:     }
     421:
     422:     /**
     423:      * Filter the query on the company column
     424:      *
     425:      * Example usage:
     426:      * <code>
     427:      * $query->filterByCompany('fooValue');   // WHERE company = 'fooValue'
     428:      * $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
     429:      * </code>
     430:      *
     431:      * @param     string $company The value to use as filter.
     432:      *              Accepts wildcards (* and % trigger a LIKE)
     433:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     434:      *
     435:      * @return CustomerQuery The current query, for fluid interface
     436:      */
     437:     public function filterByCompany($company = null, $comparison = null)
     438:     {
     439:         if (null === $comparison) {
     440:             if (is_array($company)) {
     441:                 $comparison = Criteria::IN;
     442:             } elseif (preg_match('/[\%\*]/', $company)) {
     443:                 $company = str_replace('*', '%', $company);
     444:                 $comparison = Criteria::LIKE;
     445:             }
     446:         }
     447:
     448:         return $this->addUsingAlias(CustomerPeer::COMPANY, $company, $comparison);
     449:     }
     450:
     451:     /**
     452:      * Filter the query on the firstname column
     453:      *
     454:      * Example usage:
     455:      * <code>
     456:      * $query->filterByFirstname('fooValue');   // WHERE firstname = 'fooValue'
     457:      * $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
     458:      * </code>
     459:      *
     460:      * @param     string $firstname The value to use as filter.
     461:      *              Accepts wildcards (* and % trigger a LIKE)
     462:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     463:      *
     464:      * @return CustomerQuery The current query, for fluid interface
     465:      */
     466:     public function filterByFirstname($firstname = null, $comparison = null)
     467:     {
     468:         if (null === $comparison) {
     469:             if (is_array($firstname)) {
     470:                 $comparison = Criteria::IN;
     471:             } elseif (preg_match('/[\%\*]/', $firstname)) {
     472:                 $firstname = str_replace('*', '%', $firstname);
     473:                 $comparison = Criteria::LIKE;
     474:             }
     475:         }
     476:
     477:         return $this->addUsingAlias(CustomerPeer::FIRSTNAME, $firstname, $comparison);
     478:     }
     479:
     480:     /**
     481:      * Filter the query on the lastname column
     482:      *
     483:      * Example usage:
     484:      * <code>
     485:      * $query->filterByLastname('fooValue');   // WHERE lastname = 'fooValue'
     486:      * $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
     487:      * </code>
     488:      *
     489:      * @param     string $lastname The value to use as filter.
     490:      *              Accepts wildcards (* and % trigger a LIKE)
     491:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     492:      *
     493:      * @return CustomerQuery The current query, for fluid interface
     494:      */
     495:     public function filterByLastname($lastname = null, $comparison = null)
     496:     {
     497:         if (null === $comparison) {
     498:             if (is_array($lastname)) {
     499:                 $comparison = Criteria::IN;
     500:             } elseif (preg_match('/[\%\*]/', $lastname)) {
     501:                 $lastname = str_replace('*', '%', $lastname);
     502:                 $comparison = Criteria::LIKE;
     503:             }
     504:         }
     505:
     506:         return $this->addUsingAlias(CustomerPeer::LASTNAME, $lastname, $comparison);
     507:     }
     508:
     509:     /**
     510:      * Filter the query on the address1 column
     511:      *
     512:      * Example usage:
     513:      * <code>
     514:      * $query->filterByAddress1('fooValue');   // WHERE address1 = 'fooValue'
     515:      * $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
     516:      * </code>
     517:      *
     518:      * @param     string $address1 The value to use as filter.
     519:      *              Accepts wildcards (* and % trigger a LIKE)
     520:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     521:      *
     522:      * @return CustomerQuery The current query, for fluid interface
     523:      */
     524:     public function filterByAddress1($address1 = null, $comparison = null)
     525:     {
     526:         if (null === $comparison) {
     527:             if (is_array($address1)) {
     528:                 $comparison = Criteria::IN;
     529:             } elseif (preg_match('/[\%\*]/', $address1)) {
     530:                 $address1 = str_replace('*', '%', $address1);
     531:                 $comparison = Criteria::LIKE;
     532:             }
     533:         }
     534:
     535:         return $this->addUsingAlias(CustomerPeer::ADDRESS1, $address1, $comparison);
     536:     }
     537:
     538:     /**
     539:      * Filter the query on the address2 column
     540:      *
     541:      * Example usage:
     542:      * <code>
     543:      * $query->filterByAddress2('fooValue');   // WHERE address2 = 'fooValue'
     544:      * $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
     545:      * </code>
     546:      *
     547:      * @param     string $address2 The value to use as filter.
     548:      *              Accepts wildcards (* and % trigger a LIKE)
     549:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     550:      *
     551:      * @return CustomerQuery The current query, for fluid interface
     552:      */
     553:     public function filterByAddress2($address2 = null, $comparison = null)
     554:     {
     555:         if (null === $comparison) {
     556:             if (is_array($address2)) {
     557:                 $comparison = Criteria::IN;
     558:             } elseif (preg_match('/[\%\*]/', $address2)) {
     559:                 $address2 = str_replace('*', '%', $address2);
     560:                 $comparison = Criteria::LIKE;
     561:             }
     562:         }
     563:
     564:         return $this->addUsingAlias(CustomerPeer::ADDRESS2, $address2, $comparison);
     565:     }
     566:
     567:     /**
     568:      * Filter the query on the address3 column
     569:      *
     570:      * Example usage:
     571:      * <code>
     572:      * $query->filterByAddress3('fooValue');   // WHERE address3 = 'fooValue'
     573:      * $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
     574:      * </code>
     575:      *
     576:      * @param     string $address3 The value to use as filter.
     577:      *              Accepts wildcards (* and % trigger a LIKE)
     578:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     579:      *
     580:      * @return CustomerQuery The current query, for fluid interface
     581:      */
     582:     public function filterByAddress3($address3 = null, $comparison = null)
     583:     {
     584:         if (null === $comparison) {
     585:             if (is_array($address3)) {
     586:                 $comparison = Criteria::IN;
     587:             } elseif (preg_match('/[\%\*]/', $address3)) {
     588:                 $address3 = str_replace('*', '%', $address3);
     589:                 $comparison = Criteria::LIKE;
     590:             }
     591:         }
     592:
     593:         return $this->addUsingAlias(CustomerPeer::ADDRESS3, $address3, $comparison);
     594:     }
     595:
     596:     /**
     597:      * Filter the query on the zipcode column
     598:      *
     599:      * Example usage:
     600:      * <code>
     601:      * $query->filterByZipcode('fooValue');   // WHERE zipcode = 'fooValue'
     602:      * $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
     603:      * </code>
     604:      *
     605:      * @param     string $zipcode The value to use as filter.
     606:      *              Accepts wildcards (* and % trigger a LIKE)
     607:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     608:      *
     609:      * @return CustomerQuery The current query, for fluid interface
     610:      */
     611:     public function filterByZipcode($zipcode = null, $comparison = null)
     612:     {
     613:         if (null === $comparison) {
     614:             if (is_array($zipcode)) {
     615:                 $comparison = Criteria::IN;
     616:             } elseif (preg_match('/[\%\*]/', $zipcode)) {
     617:                 $zipcode = str_replace('*', '%', $zipcode);
     618:                 $comparison = Criteria::LIKE;
     619:             }
     620:         }
     621:
     622:         return $this->addUsingAlias(CustomerPeer::ZIPCODE, $zipcode, $comparison);
     623:     }
     624:
     625:     /**
     626:      * Filter the query on the city column
     627:      *
     628:      * Example usage:
     629:      * <code>
     630:      * $query->filterByCity('fooValue');   // WHERE city = 'fooValue'
     631:      * $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
     632:      * </code>
     633:      *
     634:      * @param     string $city The value to use as filter.
     635:      *              Accepts wildcards (* and % trigger a LIKE)
     636:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     637:      *
     638:      * @return CustomerQuery The current query, for fluid interface
     639:      */
     640:     public function filterByCity($city = null, $comparison = null)
     641:     {
     642:         if (null === $comparison) {
     643:             if (is_array($city)) {
     644:                 $comparison = Criteria::IN;
     645:             } elseif (preg_match('/[\%\*]/', $city)) {
     646:                 $city = str_replace('*', '%', $city);
     647:                 $comparison = Criteria::LIKE;
     648:             }
     649:         }
     650:
     651:         return $this->addUsingAlias(CustomerPeer::CITY, $city, $comparison);
     652:     }
     653:
     654:     /**
     655:      * Filter the query on the country_id column
     656:      *
     657:      * Example usage:
     658:      * <code>
     659:      * $query->filterByCountryId(1234); // WHERE country_id = 1234
     660:      * $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
     661:      * $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
     662:      * </code>
     663:      *
     664:      * @param     mixed $countryId The value to use as filter.
     665:      *              Use scalar values for equality.
     666:      *              Use array values for in_array() equivalent.
     667:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     668:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     669:      *
     670:      * @return CustomerQuery The current query, for fluid interface
     671:      */
     672:     public function filterByCountryId($countryId = null, $comparison = null)
     673:     {
     674:         if (is_array($countryId)) {
     675:             $useMinMax = false;
     676:             if (isset($countryId['min'])) {
     677:                 $this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
     678:                 $useMinMax = true;
     679:             }
     680:             if (isset($countryId['max'])) {
     681:                 $this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
     682:                 $useMinMax = true;
     683:             }
     684:             if ($useMinMax) {
     685:                 return $this;
     686:             }
     687:             if (null === $comparison) {
     688:                 $comparison = Criteria::IN;
     689:             }
     690:         }
     691:
     692:         return $this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId, $comparison);
     693:     }
     694:
     695:     /**
     696:      * Filter the query on the phone column
     697:      *
     698:      * Example usage:
     699:      * <code>
     700:      * $query->filterByPhone('fooValue');   // WHERE phone = 'fooValue'
     701:      * $query->filterByPhone('%fooValue%'); // WHERE phone LIKE '%fooValue%'
     702:      * </code>
     703:      *
     704:      * @param     string $phone The value to use as filter.
     705:      *              Accepts wildcards (* and % trigger a LIKE)
     706:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     707:      *
     708:      * @return CustomerQuery The current query, for fluid interface
     709:      */
     710:     public function filterByPhone($phone = null, $comparison = null)
     711:     {
     712:         if (null === $comparison) {
     713:             if (is_array($phone)) {
     714:                 $comparison = Criteria::IN;
     715:             } elseif (preg_match('/[\%\*]/', $phone)) {
     716:                 $phone = str_replace('*', '%', $phone);
     717:                 $comparison = Criteria::LIKE;
     718:             }
     719:         }
     720:
     721:         return $this->addUsingAlias(CustomerPeer::PHONE, $phone, $comparison);
     722:     }
     723:
     724:     /**
     725:      * Filter the query on the cellphone column
     726:      *
     727:      * Example usage:
     728:      * <code>
     729:      * $query->filterByCellphone('fooValue');   // WHERE cellphone = 'fooValue'
     730:      * $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%'
     731:      * </code>
     732:      *
     733:      * @param     string $cellphone The value to use as filter.
     734:      *              Accepts wildcards (* and % trigger a LIKE)
     735:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     736:      *
     737:      * @return CustomerQuery The current query, for fluid interface
     738:      */
     739:     public function filterByCellphone($cellphone = null, $comparison = null)
     740:     {
     741:         if (null === $comparison) {
     742:             if (is_array($cellphone)) {
     743:                 $comparison = Criteria::IN;
     744:             } elseif (preg_match('/[\%\*]/', $cellphone)) {
     745:                 $cellphone = str_replace('*', '%', $cellphone);
     746:                 $comparison = Criteria::LIKE;
     747:             }
     748:         }
     749:
     750:         return $this->addUsingAlias(CustomerPeer::CELLPHONE, $cellphone, $comparison);
     751:     }
     752:
     753:     /**
     754:      * Filter the query on the email column
     755:      *
     756:      * Example usage:
     757:      * <code>
     758:      * $query->filterByEmail('fooValue');   // WHERE email = 'fooValue'
     759:      * $query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
     760:      * </code>
     761:      *
     762:      * @param     string $email The value to use as filter.
     763:      *              Accepts wildcards (* and % trigger a LIKE)
     764:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     765:      *
     766:      * @return CustomerQuery The current query, for fluid interface
     767:      */
     768:     public function filterByEmail($email = null, $comparison = null)
     769:     {
     770:         if (null === $comparison) {
     771:             if (is_array($email)) {
     772:                 $comparison = Criteria::IN;
     773:             } elseif (preg_match('/[\%\*]/', $email)) {
     774:                 $email = str_replace('*', '%', $email);
     775:                 $comparison = Criteria::LIKE;
     776:             }
     777:         }
     778:
     779:         return $this->addUsingAlias(CustomerPeer::EMAIL, $email, $comparison);
     780:     }
     781:
     782:     /**
     783:      * Filter the query on the password column
     784:      *
     785:      * Example usage:
     786:      * <code>
     787:      * $query->filterByPassword('fooValue');   // WHERE password = 'fooValue'
     788:      * $query->filterByPassword('%fooValue%'); // WHERE password LIKE '%fooValue%'
     789:      * </code>
     790:      *
     791:      * @param     string $password The value to use as filter.
     792:      *              Accepts wildcards (* and % trigger a LIKE)
     793:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     794:      *
     795:      * @return CustomerQuery The current query, for fluid interface
     796:      */
     797:     public function filterByPassword($password = null, $comparison = null)
     798:     {
     799:         if (null === $comparison) {
     800:             if (is_array($password)) {
     801:                 $comparison = Criteria::IN;
     802:             } elseif (preg_match('/[\%\*]/', $password)) {
     803:                 $password = str_replace('*', '%', $password);
     804:                 $comparison = Criteria::LIKE;
     805:             }
     806:         }
     807:
     808:         return $this->addUsingAlias(CustomerPeer::PASSWORD, $password, $comparison);
     809:     }
     810:
     811:     /**
     812:      * Filter the query on the algo column
     813:      *
     814:      * Example usage:
     815:      * <code>
     816:      * $query->filterByAlgo('fooValue');   // WHERE algo = 'fooValue'
     817:      * $query->filterByAlgo('%fooValue%'); // WHERE algo LIKE '%fooValue%'
     818:      * </code>
     819:      *
     820:      * @param     string $algo The value to use as filter.
     821:      *              Accepts wildcards (* and % trigger a LIKE)
     822:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     823:      *
     824:      * @return CustomerQuery The current query, for fluid interface
     825:      */
     826:     public function filterByAlgo($algo = null, $comparison = null)
     827:     {
     828:         if (null === $comparison) {
     829:             if (is_array($algo)) {
     830:                 $comparison = Criteria::IN;
     831:             } elseif (preg_match('/[\%\*]/', $algo)) {
     832:                 $algo = str_replace('*', '%', $algo);
     833:                 $comparison = Criteria::LIKE;
     834:             }
     835:         }
     836:
     837:         return $this->addUsingAlias(CustomerPeer::ALGO, $algo, $comparison);
     838:     }
     839:
     840:     /**
     841:      * Filter the query on the salt column
     842:      *
     843:      * Example usage:
     844:      * <code>
     845:      * $query->filterBySalt('fooValue');   // WHERE salt = 'fooValue'
     846:      * $query->filterBySalt('%fooValue%'); // WHERE salt LIKE '%fooValue%'
     847:      * </code>
     848:      *
     849:      * @param     string $salt The value to use as filter.
     850:      *              Accepts wildcards (* and % trigger a LIKE)
     851:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     852:      *
     853:      * @return CustomerQuery The current query, for fluid interface
     854:      */
     855:     public function filterBySalt($salt = null, $comparison = null)
     856:     {
     857:         if (null === $comparison) {
     858:             if (is_array($salt)) {
     859:                 $comparison = Criteria::IN;
     860:             } elseif (preg_match('/[\%\*]/', $salt)) {
     861:                 $salt = str_replace('*', '%', $salt);
     862:                 $comparison = Criteria::LIKE;
     863:             }
     864:         }
     865:
     866:         return $this->addUsingAlias(CustomerPeer::SALT, $salt, $comparison);
     867:     }
     868:
     869:     /**
     870:      * Filter the query on the reseller column
     871:      *
     872:      * Example usage:
     873:      * <code>
     874:      * $query->filterByReseller(1234); // WHERE reseller = 1234
     875:      * $query->filterByReseller(array(12, 34)); // WHERE reseller IN (12, 34)
     876:      * $query->filterByReseller(array('min' => 12)); // WHERE reseller > 12
     877:      * </code>
     878:      *
     879:      * @param     mixed $reseller The value to use as filter.
     880:      *              Use scalar values for equality.
     881:      *              Use array values for in_array() equivalent.
     882:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     883:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     884:      *
     885:      * @return CustomerQuery The current query, for fluid interface
     886:      */
     887:     public function filterByReseller($reseller = null, $comparison = null)
     888:     {
     889:         if (is_array($reseller)) {
     890:             $useMinMax = false;
     891:             if (isset($reseller['min'])) {
     892:                 $this->addUsingAlias(CustomerPeer::RESELLER, $reseller['min'], Criteria::GREATER_EQUAL);
     893:                 $useMinMax = true;
     894:             }
     895:             if (isset($reseller['max'])) {
     896:                 $this->addUsingAlias(CustomerPeer::RESELLER, $reseller['max'], Criteria::LESS_EQUAL);
     897:                 $useMinMax = true;
     898:             }
     899:             if ($useMinMax) {
     900:                 return $this;
     901:             }
     902:             if (null === $comparison) {
     903:                 $comparison = Criteria::IN;
     904:             }
     905:         }
     906:
     907:         return $this->addUsingAlias(CustomerPeer::RESELLER, $reseller, $comparison);
     908:     }
     909:
     910:     /**
     911:      * Filter the query on the lang column
     912:      *
     913:      * Example usage:
     914:      * <code>
     915:      * $query->filterByLang('fooValue');   // WHERE lang = 'fooValue'
     916:      * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
     917:      * </code>
     918:      *
     919:      * @param     string $lang The value to use as filter.
     920:      *              Accepts wildcards (* and % trigger a LIKE)
     921:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     922:      *
     923:      * @return CustomerQuery The current query, for fluid interface
     924:      */
     925:     public function filterByLang($lang = null, $comparison = null)
     926:     {
     927:         if (null === $comparison) {
     928:             if (is_array($lang)) {
     929:                 $comparison = Criteria::IN;
     930:             } elseif (preg_match('/[\%\*]/', $lang)) {
     931:                 $lang = str_replace('*', '%', $lang);
     932:                 $comparison = Criteria::LIKE;
     933:             }
     934:         }
     935:
     936:         return $this->addUsingAlias(CustomerPeer::LANG, $lang, $comparison);
     937:     }
     938:
     939:     /**
     940:      * Filter the query on the sponsor column
     941:      *
     942:      * Example usage:
     943:      * <code>
     944:      * $query->filterBySponsor('fooValue');   // WHERE sponsor = 'fooValue'
     945:      * $query->filterBySponsor('%fooValue%'); // WHERE sponsor LIKE '%fooValue%'
     946:      * </code>
     947:      *
     948:      * @param     string $sponsor The value to use as filter.
     949:      *              Accepts wildcards (* and % trigger a LIKE)
     950:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     951:      *
     952:      * @return CustomerQuery The current query, for fluid interface
     953:      */
     954:     public function filterBySponsor($sponsor = null, $comparison = null)
     955:     {
     956:         if (null === $comparison) {
     957:             if (is_array($sponsor)) {
     958:                 $comparison = Criteria::IN;
     959:             } elseif (preg_match('/[\%\*]/', $sponsor)) {
     960:                 $sponsor = str_replace('*', '%', $sponsor);
     961:                 $comparison = Criteria::LIKE;
     962:             }
     963:         }
     964:
     965:         return $this->addUsingAlias(CustomerPeer::SPONSOR, $sponsor, $comparison);
     966:     }
     967:
     968:     /**
     969:      * Filter the query on the discount column
     970:      *
     971:      * Example usage:
     972:      * <code>
     973:      * $query->filterByDiscount(1234); // WHERE discount = 1234
     974:      * $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
     975:      * $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
     976:      * </code>
     977:      *
     978:      * @param     mixed $discount The value to use as filter.
     979:      *              Use scalar values for equality.
     980:      *              Use array values for in_array() equivalent.
     981:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     982:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     983:      *
     984:      * @return CustomerQuery The current query, for fluid interface
     985:      */
     986:     public function filterByDiscount($discount = null, $comparison = null)
     987:     {
     988:         if (is_array($discount)) {
     989:             $useMinMax = false;
     990:             if (isset($discount['min'])) {
     991:                 $this->addUsingAlias(CustomerPeer::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
     992:                 $useMinMax = true;
     993:             }
     994:             if (isset($discount['max'])) {
     995:                 $this->addUsingAlias(CustomerPeer::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
     996:                 $useMinMax = true;
     997:             }
     998:             if ($useMinMax) {
     999:                 return $this;
    1000:             }
    1001:             if (null === $comparison) {
    1002:                 $comparison = Criteria::IN;
    1003:             }
    1004:         }
    1005:
    1006:         return $this->addUsingAlias(CustomerPeer::DISCOUNT, $discount, $comparison);
    1007:     }
    1008:
    1009:     /**
    1010:      * Filter the query on the created_at column
    1011:      *
    1012:      * Example usage:
    1013:      * <code>
    1014:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    1015:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    1016:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    1017:      * </code>
    1018:      *
    1019:      * @param     mixed $createdAt The value to use as filter.
    1020:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    1021:      *              Empty strings are treated as NULL.
    1022:      *              Use scalar values for equality.
    1023:      *              Use array values for in_array() equivalent.
    1024:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    1025:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1026:      *
    1027:      * @return CustomerQuery The current query, for fluid interface
    1028:      */
    1029:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    1030:     {
    1031:         if (is_array($createdAt)) {
    1032:             $useMinMax = false;
    1033:             if (isset($createdAt['min'])) {
    1034:                 $this->addUsingAlias(CustomerPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    1035:                 $useMinMax = true;
    1036:             }
    1037:             if (isset($createdAt['max'])) {
    1038:                 $this->addUsingAlias(CustomerPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    1039:                 $useMinMax = true;
    1040:             }
    1041:             if ($useMinMax) {
    1042:                 return $this;
    1043:             }
    1044:             if (null === $comparison) {
    1045:                 $comparison = Criteria::IN;
    1046:             }
    1047:         }
    1048:
    1049:         return $this->addUsingAlias(CustomerPeer::CREATED_AT, $createdAt, $comparison);
    1050:     }
    1051:
    1052:     /**
    1053:      * Filter the query on the updated_at column
    1054:      *
    1055:      * Example usage:
    1056:      * <code>
    1057:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    1058:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    1059:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    1060:      * </code>
    1061:      *
    1062:      * @param     mixed $updatedAt The value to use as filter.
    1063:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    1064:      *              Empty strings are treated as NULL.
    1065:      *              Use scalar values for equality.
    1066:      *              Use array values for in_array() equivalent.
    1067:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    1068:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1069:      *
    1070:      * @return CustomerQuery The current query, for fluid interface
    1071:      */
    1072:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    1073:     {
    1074:         if (is_array($updatedAt)) {
    1075:             $useMinMax = false;
    1076:             if (isset($updatedAt['min'])) {
    1077:                 $this->addUsingAlias(CustomerPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    1078:                 $useMinMax = true;
    1079:             }
    1080:             if (isset($updatedAt['max'])) {
    1081:                 $this->addUsingAlias(CustomerPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    1082:                 $useMinMax = true;
    1083:             }
    1084:             if ($useMinMax) {
    1085:                 return $this;
    1086:             }
    1087:             if (null === $comparison) {
    1088:                 $comparison = Criteria::IN;
    1089:             }
    1090:         }
    1091:
    1092:         return $this->addUsingAlias(CustomerPeer::UPDATED_AT, $updatedAt, $comparison);
    1093:     }
    1094:
    1095:     /**
    1096:      * Filter the query by a related CustomerTitle object
    1097:      *
    1098:      * @param   CustomerTitle|PropelObjectCollection $customerTitle The related object(s) to use as filter
    1099:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1100:      *
    1101:      * @return   CustomerQuery The current query, for fluid interface
    1102:      * @throws   PropelException - if the provided filter is invalid.
    1103:      */
    1104:     public function filterByCustomerTitle($customerTitle, $comparison = null)
    1105:     {
    1106:         if ($customerTitle instanceof CustomerTitle) {
    1107:             return $this
    1108:                 ->addUsingAlias(CustomerPeer::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
    1109:         } elseif ($customerTitle instanceof PropelObjectCollection) {
    1110:             if (null === $comparison) {
    1111:                 $comparison = Criteria::IN;
    1112:             }
    1113:
    1114:             return $this
    1115:                 ->addUsingAlias(CustomerPeer::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
    1116:         } else {
    1117:             throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection');
    1118:         }
    1119:     }
    1120:
    1121:     /**
    1122:      * Adds a JOIN clause to the query using the CustomerTitle relation
    1123:      *
    1124:      * @param     string $relationAlias optional alias for the relation
    1125:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1126:      *
    1127:      * @return CustomerQuery The current query, for fluid interface
    1128:      */
    1129:     public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    1130:     {
    1131:         $tableMap = $this->getTableMap();
    1132:         $relationMap = $tableMap->getRelation('CustomerTitle');
    1133:
    1134:         // create a ModelJoin object for this join
    1135:         $join = new ModelJoin();
    1136:         $join->setJoinType($joinType);
    1137:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    1138:         if ($previousJoin = $this->getPreviousJoin()) {
    1139:             $join->setPreviousJoin($previousJoin);
    1140:         }
    1141:
    1142:         // add the ModelJoin to the current object
    1143:         if ($relationAlias) {
    1144:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    1145:             $this->addJoinObject($join, $relationAlias);
    1146:         } else {
    1147:             $this->addJoinObject($join, 'CustomerTitle');
    1148:         }
    1149:
    1150:         return $this;
    1151:     }
    1152:
    1153:     /**
    1154:      * Use the CustomerTitle relation CustomerTitle object
    1155:      *
    1156:      * @see       useQuery()
    1157:      *
    1158:      * @param     string $relationAlias optional alias for the relation,
    1159:      *                                   to be used as main alias in the secondary query
    1160:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1161:      *
    1162:      * @return   \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
    1163:      */
    1164:     public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    1165:     {
    1166:         return $this
    1167:             ->joinCustomerTitle($relationAlias, $joinType)
    1168:             ->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
    1169:     }
    1170:
    1171:     /**
    1172:      * Filter the query by a related Address object
    1173:      *
    1174:      * @param   Address|PropelObjectCollection $address  the related object to use as filter
    1175:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1176:      *
    1177:      * @return   CustomerQuery The current query, for fluid interface
    1178:      * @throws   PropelException - if the provided filter is invalid.
    1179:      */
    1180:     public function filterByAddress($address, $comparison = null)
    1181:     {
    1182:         if ($address instanceof Address) {
    1183:             return $this
    1184:                 ->addUsingAlias(CustomerPeer::ID, $address->getCustomerId(), $comparison);
    1185:         } elseif ($address instanceof PropelObjectCollection) {
    1186:             return $this
    1187:                 ->useAddressQuery()
    1188:                 ->filterByPrimaryKeys($address->getPrimaryKeys())
    1189:                 ->endUse();
    1190:         } else {
    1191:             throw new PropelException('filterByAddress() only accepts arguments of type Address or PropelCollection');
    1192:         }
    1193:     }
    1194:
    1195:     /**
    1196:      * Adds a JOIN clause to the query using the Address relation
    1197:      *
    1198:      * @param     string $relationAlias optional alias for the relation
    1199:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1200:      *
    1201:      * @return CustomerQuery The current query, for fluid interface
    1202:      */
    1203:     public function joinAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1204:     {
    1205:         $tableMap = $this->getTableMap();
    1206:         $relationMap = $tableMap->getRelation('Address');
    1207:
    1208:         // create a ModelJoin object for this join
    1209:         $join = new ModelJoin();
    1210:         $join->setJoinType($joinType);
    1211:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    1212:         if ($previousJoin = $this->getPreviousJoin()) {
    1213:             $join->setPreviousJoin($previousJoin);
    1214:         }
    1215:
    1216:         // add the ModelJoin to the current object
    1217:         if ($relationAlias) {
    1218:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    1219:             $this->addJoinObject($join, $relationAlias);
    1220:         } else {
    1221:             $this->addJoinObject($join, 'Address');
    1222:         }
    1223:
    1224:         return $this;
    1225:     }
    1226:
    1227:     /**
    1228:      * Use the Address relation Address object
    1229:      *
    1230:      * @see       useQuery()
    1231:      *
    1232:      * @param     string $relationAlias optional alias for the relation,
    1233:      *                                   to be used as main alias in the secondary query
    1234:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1235:      *
    1236:      * @return   \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
    1237:      */
    1238:     public function useAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1239:     {
    1240:         return $this
    1241:             ->joinAddress($relationAlias, $joinType)
    1242:             ->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
    1243:     }
    1244:
    1245:     /**
    1246:      * Filter the query by a related Order object
    1247:      *
    1248:      * @param   Order|PropelObjectCollection $order  the related object to use as filter
    1249:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    1250:      *
    1251:      * @return   CustomerQuery The current query, for fluid interface
    1252:      * @throws   PropelException - if the provided filter is invalid.
    1253:      */
    1254:     public function filterByOrder($order, $comparison = null)
    1255:     {
    1256:         if ($order instanceof Order) {
    1257:             return $this
    1258:                 ->addUsingAlias(CustomerPeer::ID, $order->getCustomerId(), $comparison);
    1259:         } elseif ($order instanceof PropelObjectCollection) {
    1260:             return $this
    1261:                 ->useOrderQuery()
    1262:                 ->filterByPrimaryKeys($order->getPrimaryKeys())
    1263:                 ->endUse();
    1264:         } else {
    1265:             throw new PropelException('filterByOrder() only accepts arguments of type Order or PropelCollection');
    1266:         }
    1267:     }
    1268:
    1269:     /**
    1270:      * Adds a JOIN clause to the query using the Order relation
    1271:      *
    1272:      * @param     string $relationAlias optional alias for the relation
    1273:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1274:      *
    1275:      * @return CustomerQuery The current query, for fluid interface
    1276:      */
    1277:     public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1278:     {
    1279:         $tableMap = $this->getTableMap();
    1280:         $relationMap = $tableMap->getRelation('Order');
    1281:
    1282:         // create a ModelJoin object for this join
    1283:         $join = new ModelJoin();
    1284:         $join->setJoinType($joinType);
    1285:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    1286:         if ($previousJoin = $this->getPreviousJoin()) {
    1287:             $join->setPreviousJoin($previousJoin);
    1288:         }
    1289:
    1290:         // add the ModelJoin to the current object
    1291:         if ($relationAlias) {
    1292:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    1293:             $this->addJoinObject($join, $relationAlias);
    1294:         } else {
    1295:             $this->addJoinObject($join, 'Order');
    1296:         }
    1297:
    1298:         return $this;
    1299:     }
    1300:
    1301:     /**
    1302:      * Use the Order relation Order object
    1303:      *
    1304:      * @see       useQuery()
    1305:      *
    1306:      * @param     string $relationAlias optional alias for the relation,
    1307:      *                                   to be used as main alias in the secondary query
    1308:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    1309:      *
    1310:      * @return   \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
    1311:      */
    1312:     public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    1313:     {
    1314:         return $this
    1315:             ->joinOrder($relationAlias, $joinType)
    1316:             ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
    1317:     }
    1318:
    1319:     /**
    1320:      * Exclude object from result
    1321:      *
    1322:      * @param   Customer $customer Object to remove from the list of results
    1323:      *
    1324:      * @return CustomerQuery The current query, for fluid interface
    1325:      */
    1326:     public function prune($customer = null)
    1327:     {
    1328:         if ($customer) {
    1329:             $this->addUsingAlias(CustomerPeer::ID, $customer->getId(), Criteria::NOT_EQUAL);
    1330:         }
    1331:
    1332:         return $this;
    1333:     }
    1334:
    1335:     // timestampable behavior
    1336:
    1337:     /**
    1338:      * Filter by the latest updated
    1339:      *
    1340:      * @param      int $nbDays Maximum age of the latest update in days
    1341:      *
    1342:      * @return     CustomerQuery The current query, for fluid interface
    1343:      */
    1344:     public function recentlyUpdated($nbDays = 7)
    1345:     {
    1346:         return $this->addUsingAlias(CustomerPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    1347:     }
    1348:
    1349:     /**
    1350:      * Order by update date desc
    1351:      *
    1352:      * @return     CustomerQuery The current query, for fluid interface
    1353:      */
    1354:     public function lastUpdatedFirst()
    1355:     {
    1356:         return $this->addDescendingOrderByColumn(CustomerPeer::UPDATED_AT);
    1357:     }
    1358:
    1359:     /**
    1360:      * Order by update date asc
    1361:      *
    1362:      * @return     CustomerQuery The current query, for fluid interface
    1363:      */
    1364:     public function firstUpdatedFirst()
    1365:     {
    1366:         return $this->addAscendingOrderByColumn(CustomerPeer::UPDATED_AT);
    1367:     }
    1368:
    1369:     /**
    1370:      * Filter by the latest created
    1371:      *
    1372:      * @param      int $nbDays Maximum age of in days
    1373:      *
    1374:      * @return     CustomerQuery The current query, for fluid interface
    1375:      */
    1376:     public function recentlyCreated($nbDays = 7)
    1377:     {
    1378:         return $this->addUsingAlias(CustomerPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    1379:     }
    1380:
    1381:     /**
    1382:      * Order by create date desc
    1383:      *
    1384:      * @return     CustomerQuery The current query, for fluid interface
    1385:      */
    1386:     public function lastCreatedFirst()
    1387:     {
    1388:         return $this->addDescendingOrderByColumn(CustomerPeer::CREATED_AT);
    1389:     }
    1390:
    1391:     /**
    1392:      * Order by create date asc
    1393:      *
    1394:      * @return     CustomerQuery The current query, for fluid interface
    1395:      */
    1396:     public function firstCreatedFirst()
    1397:     {
    1398:         return $this->addAscendingOrderByColumn(CustomerPeer::CREATED_AT);
    1399:     }
    1400: }
    1401: