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