      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\Order;
     16: use Thelia\Model\OrderAddress;
     17: use Thelia\Model\OrderAddressPeer;
     18: use Thelia\Model\OrderAddressQuery;
     19:
     20: /**
     21:  * Base class that represents a query for the 'order_address' table.
     22:  *
     23:  *
     24:  *
     25:  * @method OrderAddressQuery orderById($order = Criteria::ASC) Order by the id column
     26:  * @method OrderAddressQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
     27:  * @method OrderAddressQuery orderByCompany($order = Criteria::ASC) Order by the company column
     28:  * @method OrderAddressQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
     29:  * @method OrderAddressQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
     30:  * @method OrderAddressQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
     31:  * @method OrderAddressQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
     32:  * @method OrderAddressQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
     33:  * @method OrderAddressQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
     34:  * @method OrderAddressQuery orderByCity($order = Criteria::ASC) Order by the city column
     35:  * @method OrderAddressQuery orderByPhone($order = Criteria::ASC) Order by the phone column
     36:  * @method OrderAddressQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
     37:  * @method OrderAddressQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     38:  * @method OrderAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     39:  *
     40:  * @method OrderAddressQuery groupById() Group by the id column
     41:  * @method OrderAddressQuery groupByCustomerTitleId() Group by the customer_title_id column
     42:  * @method OrderAddressQuery groupByCompany() Group by the company column
     43:  * @method OrderAddressQuery groupByFirstname() Group by the firstname column
     44:  * @method OrderAddressQuery groupByLastname() Group by the lastname column
     45:  * @method OrderAddressQuery groupByAddress1() Group by the address1 column
     46:  * @method OrderAddressQuery groupByAddress2() Group by the address2 column
     47:  * @method OrderAddressQuery groupByAddress3() Group by the address3 column
     48:  * @method OrderAddressQuery groupByZipcode() Group by the zipcode column
     49:  * @method OrderAddressQuery groupByCity() Group by the city column
     50:  * @method OrderAddressQuery groupByPhone() Group by the phone column
     51:  * @method OrderAddressQuery groupByCountryId() Group by the country_id column
     52:  * @method OrderAddressQuery groupByCreatedAt() Group by the created_at column
     53:  * @method OrderAddressQuery groupByUpdatedAt() Group by the updated_at column
     54:  *
     55:  * @method OrderAddressQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     56:  * @method OrderAddressQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     57:  * @method OrderAddressQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     58:  *
     59:  * @method OrderAddressQuery leftJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByAddressInvoice relation
     60:  * @method OrderAddressQuery rightJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByAddressInvoice relation
     61:  * @method OrderAddressQuery innerJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByAddressInvoice relation
     62:  *
     63:  * @method OrderAddressQuery leftJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByAddressDelivery relation
     64:  * @method OrderAddressQuery rightJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByAddressDelivery relation
     65:  * @method OrderAddressQuery innerJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByAddressDelivery relation
     66:  *
     67:  * @method OrderAddress findOne(PropelPDO $con = null) Return the first OrderAddress matching the query
     68:  * @method OrderAddress findOneOrCreate(PropelPDO $con = null) Return the first OrderAddress matching the query, or a new OrderAddress object populated from the query conditions when no match is found
     69:  *
     70:  * @method OrderAddress findOneByCustomerTitleId(int $customer_title_id) Return the first OrderAddress filtered by the customer_title_id column
     71:  * @method OrderAddress findOneByCompany(string $company) Return the first OrderAddress filtered by the company column
     72:  * @method OrderAddress findOneByFirstname(string $firstname) Return the first OrderAddress filtered by the firstname column
     73:  * @method OrderAddress findOneByLastname(string $lastname) Return the first OrderAddress filtered by the lastname column
     74:  * @method OrderAddress findOneByAddress1(string $address1) Return the first OrderAddress filtered by the address1 column
     75:  * @method OrderAddress findOneByAddress2(string $address2) Return the first OrderAddress filtered by the address2 column
     76:  * @method OrderAddress findOneByAddress3(string $address3) Return the first OrderAddress filtered by the address3 column
     77:  * @method OrderAddress findOneByZipcode(string $zipcode) Return the first OrderAddress filtered by the zipcode column
     78:  * @method OrderAddress findOneByCity(string $city) Return the first OrderAddress filtered by the city column
     79:  * @method OrderAddress findOneByPhone(string $phone) Return the first OrderAddress filtered by the phone column
     80:  * @method OrderAddress findOneByCountryId(int $country_id) Return the first OrderAddress filtered by the country_id column
     81:  * @method OrderAddress findOneByCreatedAt(string $created_at) Return the first OrderAddress filtered by the created_at column
     82:  * @method OrderAddress findOneByUpdatedAt(string $updated_at) Return the first OrderAddress filtered by the updated_at column
     83:  *
     84:  * @method array findById(int $id) Return OrderAddress objects filtered by the id column
     85:  * @method array findByCustomerTitleId(int $customer_title_id) Return OrderAddress objects filtered by the customer_title_id column
     86:  * @method array findByCompany(string $company) Return OrderAddress objects filtered by the company column
     87:  * @method array findByFirstname(string $firstname) Return OrderAddress objects filtered by the firstname column
     88:  * @method array findByLastname(string $lastname) Return OrderAddress objects filtered by the lastname column
     89:  * @method array findByAddress1(string $address1) Return OrderAddress objects filtered by the address1 column
     90:  * @method array findByAddress2(string $address2) Return OrderAddress objects filtered by the address2 column
     91:  * @method array findByAddress3(string $address3) Return OrderAddress objects filtered by the address3 column
     92:  * @method array findByZipcode(string $zipcode) Return OrderAddress objects filtered by the zipcode column
     93:  * @method array findByCity(string $city) Return OrderAddress objects filtered by the city column
     94:  * @method array findByPhone(string $phone) Return OrderAddress objects filtered by the phone column
     95:  * @method array findByCountryId(int $country_id) Return OrderAddress objects filtered by the country_id column
     96:  * @method array findByCreatedAt(string $created_at) Return OrderAddress objects filtered by the created_at column
     97:  * @method array findByUpdatedAt(string $updated_at) Return OrderAddress objects filtered by the updated_at column
     98:  *
     99:  * @package    propel.generator.Thelia.Model.om
    100:  */
    101: abstract class BaseOrderAddressQuery extends ModelCriteria
    102: {
    103:     /**
    104:      * Initializes internal state of BaseOrderAddressQuery object.
    105:      *
    106:      * @param     string $dbName The dabase name
    107:      * @param     string $modelName The phpName of a model, e.g. 'Book'
    108:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
    109:      */
    110:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\OrderAddress', $modelAlias = null)
    111:     {
    112:         parent::__construct($dbName, $modelName, $modelAlias);
    113:     }
    114:
    115:     /**
    116:      * Returns a new OrderAddressQuery object.
    117:      *
    118:      * @param     string $modelAlias The alias of a model in the query
    119:      * @param   OrderAddressQuery|Criteria $criteria Optional Criteria to build the query from
    120:      *
    121:      * @return OrderAddressQuery
    122:      */
    123:     public static function create($modelAlias = null, $criteria = null)
    124:     {
    125:         if ($criteria instanceof OrderAddressQuery) {
    126:             return $criteria;
    127:         }
    128:         $query = new OrderAddressQuery();
    129:         if (null !== $modelAlias) {
    130:             $query->setModelAlias($modelAlias);
    131:         }
    132:         if ($criteria instanceof Criteria) {
    133:             $query->mergeWith($criteria);
    134:         }
    135:
    136:         return $query;
    137:     }
    138:
    139:     /**
    140:      * Find object by primary key.
    141:      * Propel uses the instance pool to skip the database if the object exists.
    142:      * Go fast if the query is untouched.
    143:      *
    144:      * <code>
    145:      * $obj  = $c->findPk(12, $con);
    146:      * </code>
    147:      *
    148:      * @param mixed $key Primary key to use for the query
    149:      * @param     PropelPDO $con an optional connection object
    150:      *
    151:      * @return   OrderAddress|OrderAddress[]|mixed the result, formatted by the current formatter
    152:      */
    153:     public function findPk($key, $con = null)
    154:     {
    155:         if ($key === null) {
    156:             return null;
    157:         }
    158:         if ((null !== ($obj = OrderAddressPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
    159:             // the object is alredy in the instance pool
    160:             return $obj;
    161:         }
    162:         if ($con === null) {
    163:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    164:         }
    165:         $this->basePreSelect($con);
    166:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
    167:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
    168:          || $this->map || $this->having || $this->joins) {
    169:             return $this->findPkComplex($key, $con);
    170:         } else {
    171:             return $this->findPkSimple($key, $con);
    172:         }
    173:     }
    174:
    175:     /**
    176:      * Alias of findPk to use instance pooling
    177:      *
    178:      * @param     mixed $key Primary key to use for the query
    179:      * @param     PropelPDO $con A connection object
    180:      *
    181:      * @return                 OrderAddress A model object, or null if the key is not found
    182:      * @throws PropelException
    183:      */
    184:      public function findOneById($key, $con = null)
    185:      {
    186:         return $this->findPk($key, $con);
    187:      }
    188:
    189:     /**
    190:      * Find object by primary key using raw SQL to go fast.
    191:      * Bypass doSelect() and the object formatter by using generated code.
    192:      *
    193:      * @param     mixed $key Primary key to use for the query
    194:      * @param     PropelPDO $con A connection object
    195:      *
    196:      * @return                 OrderAddress A model object, or null if the key is not found
    197:      * @throws PropelException
    198:      */
    199:     protected function findPkSimple($key, $con)
    200:     {
    201:         $sql = 'SELECT `id`, `customer_title_id`, `company`, `firstname`, `lastname`, `address1`, `address2`, `address3`, `zipcode`, `city`, `phone`, `country_id`, `created_at`, `updated_at` FROM `order_address` WHERE `id` = :p0';
    202:         try {
    203:             $stmt = $con->prepare($sql);
    204:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
    205:             $stmt->execute();
    206:         } catch (Exception $e) {
    207:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    208:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    209:         }
    210:         $obj = null;
    211:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    212:             $obj = new OrderAddress();
    213:             $obj->hydrate($row);
    214:             OrderAddressPeer::addInstanceToPool($obj, (string) $key);
    215:         }
    216:         $stmt->closeCursor();
    217:
    218:         return $obj;
    219:     }
    220:
    221:     /**
    222:      * Find object by primary key.
    223:      *
    224:      * @param     mixed $key Primary key to use for the query
    225:      * @param     PropelPDO $con A connection object
    226:      *
    227:      * @return OrderAddress|OrderAddress[]|mixed the result, formatted by the current formatter
    228:      */
    229:     protected function findPkComplex($key, $con)
    230:     {
    231:         // As the query uses a PK condition, no limit(1) is necessary.
    232:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    233:         $stmt = $criteria
    234:             ->filterByPrimaryKey($key)
    235:             ->doSelect($con);
    236:
    237:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    238:     }
    239:
    240:     /**
    241:      * Find objects by primary key
    242:      * <code>
    243:      * $objs = $c->findPks(array(12, 56, 832), $con);
    244:      * </code>
    245:      * @param     array $keys Primary keys to use for the query
    246:      * @param     PropelPDO $con an optional connection object
    247:      *
    248:      * @return PropelObjectCollection|OrderAddress[]|mixed the list of results, formatted by the current formatter
    249:      */
    250:     public function findPks($keys, $con = null)
    251:     {
    252:         if ($con === null) {
    253:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    254:         }
    255:         $this->basePreSelect($con);
    256:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    257:         $stmt = $criteria
    258:             ->filterByPrimaryKeys($keys)
    259:             ->doSelect($con);
    260:
    261:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    262:     }
    263:
    264:     /**
    265:      * Filter the query by primary key
    266:      *
    267:      * @param     mixed $key Primary key to use for the query
    268:      *
    269:      * @return OrderAddressQuery The current query, for fluid interface
    270:      */
    271:     public function filterByPrimaryKey($key)
    272:     {
    273:
    274:         return $this->addUsingAlias(OrderAddressPeer::ID, $key, Criteria::EQUAL);
    275:     }
    276:
    277:     /**
    278:      * Filter the query by a list of primary keys
    279:      *
    280:      * @param     array $keys The list of primary key to use for the query
    281:      *
    282:      * @return OrderAddressQuery The current query, for fluid interface
    283:      */
    284:     public function filterByPrimaryKeys($keys)
    285:     {
    286:
    287:         return $this->addUsingAlias(OrderAddressPeer::ID, $keys, Criteria::IN);
    288:     }
    289:
    290:     /**
    291:      * Filter the query on the id column
    292:      *
    293:      * Example usage:
    294:      * <code>
    295:      * $query->filterById(1234); // WHERE id = 1234
    296:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    297:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
    298:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
    299:      * </code>
    300:      *
    301:      * @param     mixed $id The value to use as filter.
    302:      *              Use scalar values for equality.
    303:      *              Use array values for in_array() equivalent.
    304:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    305:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    306:      *
    307:      * @return OrderAddressQuery The current query, for fluid interface
    308:      */
    309:     public function filterById($id = null, $comparison = null)
    310:     {
    311:         if (is_array($id)) {
    312:             $useMinMax = false;
    313:             if (isset($id['min'])) {
    314:                 $this->addUsingAlias(OrderAddressPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
    315:                 $useMinMax = true;
    316:             }
    317:             if (isset($id['max'])) {
    318:                 $this->addUsingAlias(OrderAddressPeer::ID, $id['max'], Criteria::LESS_EQUAL);
    319:                 $useMinMax = true;
    320:             }
    321:             if ($useMinMax) {
    322:                 return $this;
    323:             }
    324:             if (null === $comparison) {
    325:                 $comparison = Criteria::IN;
    326:             }
    327:         }
    328:
    329:         return $this->addUsingAlias(OrderAddressPeer::ID, $id, $comparison);
    330:     }
    331:
    332:     /**
    333:      * Filter the query on the customer_title_id column
    334:      *
    335:      * Example usage:
    336:      * <code>
    337:      * $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
    338:      * $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
    339:      * $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id >= 12
    340:      * $query->filterByCustomerTitleId(array('max' => 12)); // WHERE customer_title_id <= 12
    341:      * </code>
    342:      *
    343:      * @param     mixed $customerTitleId The value to use as filter.
    344:      *              Use scalar values for equality.
    345:      *              Use array values for in_array() equivalent.
    346:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    347:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    348:      *
    349:      * @return OrderAddressQuery The current query, for fluid interface
    350:      */
    351:     public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
    352:     {
    353:         if (is_array($customerTitleId)) {
    354:             $useMinMax = false;
    355:             if (isset($customerTitleId['min'])) {
    356:                 $this->addUsingAlias(OrderAddressPeer::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
    357:                 $useMinMax = true;
    358:             }
    359:             if (isset($customerTitleId['max'])) {
    360:                 $this->addUsingAlias(OrderAddressPeer::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
    361:                 $useMinMax = true;
    362:             }
    363:             if ($useMinMax) {
    364:                 return $this;
    365:             }
    366:             if (null === $comparison) {
    367:                 $comparison = Criteria::IN;
    368:             }
    369:         }
    370:
    371:         return $this->addUsingAlias(OrderAddressPeer::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
    372:     }
    373:
    374:     /**
    375:      * Filter the query on the company column
    376:      *
    377:      * Example usage:
    378:      * <code>
    379:      * $query->filterByCompany('fooValue');   // WHERE company = 'fooValue'
    380:      * $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
    381:      * </code>
    382:      *
    383:      * @param     string $company The value to use as filter.
    384:      *              Accepts wildcards (* and % trigger a LIKE)
    385:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    386:      *
    387:      * @return OrderAddressQuery The current query, for fluid interface
    388:      */
    389:     public function filterByCompany($company = null, $comparison = null)
    390:     {
    391:         if (null === $comparison) {
    392:             if (is_array($company)) {
    393:                 $comparison = Criteria::IN;
    394:             } elseif (preg_match('/[\%\*]/', $company)) {
    395:                 $company = str_replace('*', '%', $company);
    396:                 $comparison = Criteria::LIKE;
    397:             }
    398:         }
    399:
    400:         return $this->addUsingAlias(OrderAddressPeer::COMPANY, $company, $comparison);
    401:     }
    402:
    403:     /**
    404:      * Filter the query on the firstname column
    405:      *
    406:      * Example usage:
    407:      * <code>
    408:      * $query->filterByFirstname('fooValue');   // WHERE firstname = 'fooValue'
    409:      * $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
    410:      * </code>
    411:      *
    412:      * @param     string $firstname The value to use as filter.
    413:      *              Accepts wildcards (* and % trigger a LIKE)
    414:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    415:      *
    416:      * @return OrderAddressQuery The current query, for fluid interface
    417:      */
    418:     public function filterByFirstname($firstname = null, $comparison = null)
    419:     {
    420:         if (null === $comparison) {
    421:             if (is_array($firstname)) {
    422:                 $comparison = Criteria::IN;
    423:             } elseif (preg_match('/[\%\*]/', $firstname)) {
    424:                 $firstname = str_replace('*', '%', $firstname);
    425:                 $comparison = Criteria::LIKE;
    426:             }
    427:         }
    428:
    429:         return $this->addUsingAlias(OrderAddressPeer::FIRSTNAME, $firstname, $comparison);
    430:     }
    431:
    432:     /**
    433:      * Filter the query on the lastname column
    434:      *
    435:      * Example usage:
    436:      * <code>
    437:      * $query->filterByLastname('fooValue');   // WHERE lastname = 'fooValue'
    438:      * $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
    439:      * </code>
    440:      *
    441:      * @param     string $lastname The value to use as filter.
    442:      *              Accepts wildcards (* and % trigger a LIKE)
    443:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    444:      *
    445:      * @return OrderAddressQuery The current query, for fluid interface
    446:      */
    447:     public function filterByLastname($lastname = null, $comparison = null)
    448:     {
    449:         if (null === $comparison) {
    450:             if (is_array($lastname)) {
    451:                 $comparison = Criteria::IN;
    452:             } elseif (preg_match('/[\%\*]/', $lastname)) {
    453:                 $lastname = str_replace('*', '%', $lastname);
    454:                 $comparison = Criteria::LIKE;
    455:             }
    456:         }
    457:
    458:         return $this->addUsingAlias(OrderAddressPeer::LASTNAME, $lastname, $comparison);
    459:     }
    460:
    461:     /**
    462:      * Filter the query on the address1 column
    463:      *
    464:      * Example usage:
    465:      * <code>
    466:      * $query->filterByAddress1('fooValue');   // WHERE address1 = 'fooValue'
    467:      * $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
    468:      * </code>
    469:      *
    470:      * @param     string $address1 The value to use as filter.
    471:      *              Accepts wildcards (* and % trigger a LIKE)
    472:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    473:      *
    474:      * @return OrderAddressQuery The current query, for fluid interface
    475:      */
    476:     public function filterByAddress1($address1 = null, $comparison = null)
    477:     {
    478:         if (null === $comparison) {
    479:             if (is_array($address1)) {
    480:                 $comparison = Criteria::IN;
    481:             } elseif (preg_match('/[\%\*]/', $address1)) {
    482:                 $address1 = str_replace('*', '%', $address1);
    483:                 $comparison = Criteria::LIKE;
    484:             }
    485:         }
    486:
    487:         return $this->addUsingAlias(OrderAddressPeer::ADDRESS1, $address1, $comparison);
    488:     }
    489:
    490:     /**
    491:      * Filter the query on the address2 column
    492:      *
    493:      * Example usage:
    494:      * <code>
    495:      * $query->filterByAddress2('fooValue');   // WHERE address2 = 'fooValue'
    496:      * $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
    497:      * </code>
    498:      *
    499:      * @param     string $address2 The value to use as filter.
    500:      *              Accepts wildcards (* and % trigger a LIKE)
    501:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    502:      *
    503:      * @return OrderAddressQuery The current query, for fluid interface
    504:      */
    505:     public function filterByAddress2($address2 = null, $comparison = null)
    506:     {
    507:         if (null === $comparison) {
    508:             if (is_array($address2)) {
    509:                 $comparison = Criteria::IN;
    510:             } elseif (preg_match('/[\%\*]/', $address2)) {
    511:                 $address2 = str_replace('*', '%', $address2);
    512:                 $comparison = Criteria::LIKE;
    513:             }
    514:         }
    515:
    516:         return $this->addUsingAlias(OrderAddressPeer::ADDRESS2, $address2, $comparison);
    517:     }
    518:
    519:     /**
    520:      * Filter the query on the address3 column
    521:      *
    522:      * Example usage:
    523:      * <code>
    524:      * $query->filterByAddress3('fooValue');   // WHERE address3 = 'fooValue'
    525:      * $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
    526:      * </code>
    527:      *
    528:      * @param     string $address3 The value to use as filter.
    529:      *              Accepts wildcards (* and % trigger a LIKE)
    530:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    531:      *
    532:      * @return OrderAddressQuery The current query, for fluid interface
    533:      */
    534:     public function filterByAddress3($address3 = null, $comparison = null)
    535:     {
    536:         if (null === $comparison) {
    537:             if (is_array($address3)) {
    538:                 $comparison = Criteria::IN;
    539:             } elseif (preg_match('/[\%\*]/', $address3)) {
    540:                 $address3 = str_replace('*', '%', $address3);
    541:                 $comparison = Criteria::LIKE;
    542:             }
    543:         }
    544:
    545:         return $this->addUsingAlias(OrderAddressPeer::ADDRESS3, $address3, $comparison);
    546:     }
    547:
    548:     /**
    549:      * Filter the query on the zipcode column
    550:      *
    551:      * Example usage:
    552:      * <code>
    553:      * $query->filterByZipcode('fooValue');   // WHERE zipcode = 'fooValue'
    554:      * $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
    555:      * </code>
    556:      *
    557:      * @param     string $zipcode The value to use as filter.
    558:      *              Accepts wildcards (* and % trigger a LIKE)
    559:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    560:      *
    561:      * @return OrderAddressQuery The current query, for fluid interface
    562:      */
    563:     public function filterByZipcode($zipcode = null, $comparison = null)
    564:     {
    565:         if (null === $comparison) {
    566:             if (is_array($zipcode)) {
    567:                 $comparison = Criteria::IN;
    568:             } elseif (preg_match('/[\%\*]/', $zipcode)) {
    569:                 $zipcode = str_replace('*', '%', $zipcode);
    570:                 $comparison = Criteria::LIKE;
    571:             }
    572:         }
    573:
    574:         return $this->addUsingAlias(OrderAddressPeer::ZIPCODE, $zipcode, $comparison);
    575:     }
    576:
    577:     /**
    578:      * Filter the query on the city column
    579:      *
    580:      * Example usage:
    581:      * <code>
    582:      * $query->filterByCity('fooValue');   // WHERE city = 'fooValue'
    583:      * $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
    584:      * </code>
    585:      *
    586:      * @param     string $city The value to use as filter.
    587:      *              Accepts wildcards (* and % trigger a LIKE)
    588:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    589:      *
    590:      * @return OrderAddressQuery The current query, for fluid interface
    591:      */
    592:     public function filterByCity($city = null, $comparison = null)
    593:     {
    594:         if (null === $comparison) {
    595:             if (is_array($city)) {
    596:                 $comparison = Criteria::IN;
    597:             } elseif (preg_match('/[\%\*]/', $city)) {
    598:                 $city = str_replace('*', '%', $city);
    599:                 $comparison = Criteria::LIKE;
    600:             }
    601:         }
    602:
    603:         return $this->addUsingAlias(OrderAddressPeer::CITY, $city, $comparison);
    604:     }
    605:
    606:     /**
    607:      * Filter the query on the phone column
    608:      *
    609:      * Example usage:
    610:      * <code>
    611:      * $query->filterByPhone('fooValue');   // WHERE phone = 'fooValue'
    612:      * $query->filterByPhone('%fooValue%'); // WHERE phone LIKE '%fooValue%'
    613:      * </code>
    614:      *
    615:      * @param     string $phone The value to use as filter.
    616:      *              Accepts wildcards (* and % trigger a LIKE)
    617:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    618:      *
    619:      * @return OrderAddressQuery The current query, for fluid interface
    620:      */
    621:     public function filterByPhone($phone = null, $comparison = null)
    622:     {
    623:         if (null === $comparison) {
    624:             if (is_array($phone)) {
    625:                 $comparison = Criteria::IN;
    626:             } elseif (preg_match('/[\%\*]/', $phone)) {
    627:                 $phone = str_replace('*', '%', $phone);
    628:                 $comparison = Criteria::LIKE;
    629:             }
    630:         }
    631:
    632:         return $this->addUsingAlias(OrderAddressPeer::PHONE, $phone, $comparison);
    633:     }
    634:
    635:     /**
    636:      * Filter the query on the country_id column
    637:      *
    638:      * Example usage:
    639:      * <code>
    640:      * $query->filterByCountryId(1234); // WHERE country_id = 1234
    641:      * $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
    642:      * $query->filterByCountryId(array('min' => 12)); // WHERE country_id >= 12
    643:      * $query->filterByCountryId(array('max' => 12)); // WHERE country_id <= 12
    644:      * </code>
    645:      *
    646:      * @param     mixed $countryId The value to use as filter.
    647:      *              Use scalar values for equality.
    648:      *              Use array values for in_array() equivalent.
    649:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    650:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    651:      *
    652:      * @return OrderAddressQuery The current query, for fluid interface
    653:      */
    654:     public function filterByCountryId($countryId = null, $comparison = null)
    655:     {
    656:         if (is_array($countryId)) {
    657:             $useMinMax = false;
    658:             if (isset($countryId['min'])) {
    659:                 $this->addUsingAlias(OrderAddressPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
    660:                 $useMinMax = true;
    661:             }
    662:             if (isset($countryId['max'])) {
    663:                 $this->addUsingAlias(OrderAddressPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
    664:                 $useMinMax = true;
    665:             }
    666:             if ($useMinMax) {
    667:                 return $this;
    668:             }
    669:             if (null === $comparison) {
    670:                 $comparison = Criteria::IN;
    671:             }
    672:         }
    673:
    674:         return $this->addUsingAlias(OrderAddressPeer::COUNTRY_ID, $countryId, $comparison);
    675:     }
    676:
    677:     /**
    678:      * Filter the query on the created_at column
    679:      *
    680:      * Example usage:
    681:      * <code>
    682:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    683:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    684:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    685:      * </code>
    686:      *
    687:      * @param     mixed $createdAt The value to use as filter.
    688:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    689:      *              Empty strings are treated as NULL.
    690:      *              Use scalar values for equality.
    691:      *              Use array values for in_array() equivalent.
    692:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    693:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    694:      *
    695:      * @return OrderAddressQuery The current query, for fluid interface
    696:      */
    697:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    698:     {
    699:         if (is_array($createdAt)) {
    700:             $useMinMax = false;
    701:             if (isset($createdAt['min'])) {
    702:                 $this->addUsingAlias(OrderAddressPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    703:                 $useMinMax = true;
    704:             }
    705:             if (isset($createdAt['max'])) {
    706:                 $this->addUsingAlias(OrderAddressPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    707:                 $useMinMax = true;
    708:             }
    709:             if ($useMinMax) {
    710:                 return $this;
    711:             }
    712:             if (null === $comparison) {
    713:                 $comparison = Criteria::IN;
    714:             }
    715:         }
    716:
    717:         return $this->addUsingAlias(OrderAddressPeer::CREATED_AT, $createdAt, $comparison);
    718:     }
    719:
    720:     /**
    721:      * Filter the query on the updated_at column
    722:      *
    723:      * Example usage:
    724:      * <code>
    725:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    726:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    727:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    728:      * </code>
    729:      *
    730:      * @param     mixed $updatedAt The value to use as filter.
    731:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    732:      *              Empty strings are treated as NULL.
    733:      *              Use scalar values for equality.
    734:      *              Use array values for in_array() equivalent.
    735:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    736:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    737:      *
    738:      * @return OrderAddressQuery The current query, for fluid interface
    739:      */
    740:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    741:     {
    742:         if (is_array($updatedAt)) {
    743:             $useMinMax = false;
    744:             if (isset($updatedAt['min'])) {
    745:                 $this->addUsingAlias(OrderAddressPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    746:                 $useMinMax = true;
    747:             }
    748:             if (isset($updatedAt['max'])) {
    749:                 $this->addUsingAlias(OrderAddressPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    750:                 $useMinMax = true;
    751:             }
    752:             if ($useMinMax) {
    753:                 return $this;
    754:             }
    755:             if (null === $comparison) {
    756:                 $comparison = Criteria::IN;
    757:             }
    758:         }
    759:
    760:         return $this->addUsingAlias(OrderAddressPeer::UPDATED_AT, $updatedAt, $comparison);
    761:     }
    762:
    763:     /**
    764:      * Filter the query by a related Order object
    765:      *
    766:      * @param   Order|PropelObjectCollection $order  the related object to use as filter
    767:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    768:      *
    769:      * @return                 OrderAddressQuery The current query, for fluid interface
    770:      * @throws PropelException - if the provided filter is invalid.
    771:      */
    772:     public function filterByOrderRelatedByAddressInvoice($order, $comparison = null)
    773:     {
    774:         if ($order instanceof Order) {
    775:             return $this
    776:                 ->addUsingAlias(OrderAddressPeer::ID, $order->getAddressInvoice(), $comparison);
    777:         } elseif ($order instanceof PropelObjectCollection) {
    778:             return $this
    779:                 ->useOrderRelatedByAddressInvoiceQuery()
    780:                 ->filterByPrimaryKeys($order->getPrimaryKeys())
    781:                 ->endUse();
    782:         } else {
    783:             throw new PropelException('filterByOrderRelatedByAddressInvoice() only accepts arguments of type Order or PropelCollection');
    784:         }
    785:     }
    786:
    787:     /**
    788:      * Adds a JOIN clause to the query using the OrderRelatedByAddressInvoice relation
    789:      *
    790:      * @param     string $relationAlias optional alias for the relation
    791:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    792:      *
    793:      * @return OrderAddressQuery The current query, for fluid interface
    794:      */
    795:     public function joinOrderRelatedByAddressInvoice($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    796:     {
    797:         $tableMap = $this->getTableMap();
    798:         $relationMap = $tableMap->getRelation('OrderRelatedByAddressInvoice');
    799:
    800:         // create a ModelJoin object for this join
    801:         $join = new ModelJoin();
    802:         $join->setJoinType($joinType);
    803:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    804:         if ($previousJoin = $this->getPreviousJoin()) {
    805:             $join->setPreviousJoin($previousJoin);
    806:         }
    807:
    808:         // add the ModelJoin to the current object
    809:         if ($relationAlias) {
    810:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    811:             $this->addJoinObject($join, $relationAlias);
    812:         } else {
    813:             $this->addJoinObject($join, 'OrderRelatedByAddressInvoice');
    814:         }
    815:
    816:         return $this;
    817:     }
    818:
    819:     /**
    820:      * Use the OrderRelatedByAddressInvoice relation Order object
    821:      *
    822:      * @see       useQuery()
    823:      *
    824:      * @param     string $relationAlias optional alias for the relation,
    825:      *                                   to be used as main alias in the secondary query
    826:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    827:      *
    828:      * @return   \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
    829:      */
    830:     public function useOrderRelatedByAddressInvoiceQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    831:     {
    832:         return $this
    833:             ->joinOrderRelatedByAddressInvoice($relationAlias, $joinType)
    834:             ->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByAddressInvoice', '\Thelia\Model\OrderQuery');
    835:     }
    836:
    837:     /**
    838:      * Filter the query by a related Order object
    839:      *
    840:      * @param   Order|PropelObjectCollection $order  the related object to use as filter
    841:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    842:      *
    843:      * @return                 OrderAddressQuery The current query, for fluid interface
    844:      * @throws PropelException - if the provided filter is invalid.
    845:      */
    846:     public function filterByOrderRelatedByAddressDelivery($order, $comparison = null)
    847:     {
    848:         if ($order instanceof Order) {
    849:             return $this
    850:                 ->addUsingAlias(OrderAddressPeer::ID, $order->getAddressDelivery(), $comparison);
    851:         } elseif ($order instanceof PropelObjectCollection) {
    852:             return $this
    853:                 ->useOrderRelatedByAddressDeliveryQuery()
    854:                 ->filterByPrimaryKeys($order->getPrimaryKeys())
    855:                 ->endUse();
    856:         } else {
    857:             throw new PropelException('filterByOrderRelatedByAddressDelivery() only accepts arguments of type Order or PropelCollection');
    858:         }
    859:     }
    860:
    861:     /**
    862:      * Adds a JOIN clause to the query using the OrderRelatedByAddressDelivery relation
    863:      *
    864:      * @param     string $relationAlias optional alias for the relation
    865:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    866:      *
    867:      * @return OrderAddressQuery The current query, for fluid interface
    868:      */
    869:     public function joinOrderRelatedByAddressDelivery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    870:     {
    871:         $tableMap = $this->getTableMap();
    872:         $relationMap = $tableMap->getRelation('OrderRelatedByAddressDelivery');
    873:
    874:         // create a ModelJoin object for this join
    875:         $join = new ModelJoin();
    876:         $join->setJoinType($joinType);
    877:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    878:         if ($previousJoin = $this->getPreviousJoin()) {
    879:             $join->setPreviousJoin($previousJoin);
    880:         }
    881:
    882:         // add the ModelJoin to the current object
    883:         if ($relationAlias) {
    884:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    885:             $this->addJoinObject($join, $relationAlias);
    886:         } else {
    887:             $this->addJoinObject($join, 'OrderRelatedByAddressDelivery');
    888:         }
    889:
    890:         return $this;
    891:     }
    892:
    893:     /**
    894:      * Use the OrderRelatedByAddressDelivery relation Order object
    895:      *
    896:      * @see       useQuery()
    897:      *
    898:      * @param     string $relationAlias optional alias for the relation,
    899:      *                                   to be used as main alias in the secondary query
    900:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    901:      *
    902:      * @return   \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
    903:      */
    904:     public function useOrderRelatedByAddressDeliveryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    905:     {
    906:         return $this
    907:             ->joinOrderRelatedByAddressDelivery($relationAlias, $joinType)
    908:             ->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByAddressDelivery', '\Thelia\Model\OrderQuery');
    909:     }
    910:
    911:     /**
    912:      * Exclude object from result
    913:      *
    914:      * @param   OrderAddress $orderAddress Object to remove from the list of results
    915:      *
    916:      * @return OrderAddressQuery The current query, for fluid interface
    917:      */
    918:     public function prune($orderAddress = null)
    919:     {
    920:         if ($orderAddress) {
    921:             $this->addUsingAlias(OrderAddressPeer::ID, $orderAddress->getId(), Criteria::NOT_EQUAL);
    922:         }
    923:
    924:         return $this;
    925:     }
    926:
    927:     // timestampable behavior
    928:
    929:     /**
    930:      * Filter by the latest updated
    931:      *
    932:      * @param      int $nbDays Maximum age of the latest update in days
    933:      *
    934:      * @return     OrderAddressQuery The current query, for fluid interface
    935:      */
    936:     public function recentlyUpdated($nbDays = 7)
    937:     {
    938:         return $this->addUsingAlias(OrderAddressPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    939:     }
    940:
    941:     /**
    942:      * Order by update date desc
    943:      *
    944:      * @return     OrderAddressQuery The current query, for fluid interface
    945:      */
    946:     public function lastUpdatedFirst()
    947:     {
    948:         return $this->addDescendingOrderByColumn(OrderAddressPeer::UPDATED_AT);
    949:     }
    950:
    951:     /**
    952:      * Order by update date asc
    953:      *
    954:      * @return     OrderAddressQuery The current query, for fluid interface
    955:      */
    956:     public function firstUpdatedFirst()
    957:     {
    958:         return $this->addAscendingOrderByColumn(OrderAddressPeer::UPDATED_AT);
    959:     }
    960:
    961:     /**
    962:      * Filter by the latest created
    963:      *
    964:      * @param      int $nbDays Maximum age of in days
    965:      *
    966:      * @return     OrderAddressQuery The current query, for fluid interface
    967:      */
    968:     public function recentlyCreated($nbDays = 7)
    969:     {
    970:         return $this->addUsingAlias(OrderAddressPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    971:     }
    972:
    973:     /**
    974:      * Order by create date desc
    975:      *
    976:      * @return     OrderAddressQuery The current query, for fluid interface
    977:      */
    978:     public function lastCreatedFirst()
    979:     {
    980:         return $this->addDescendingOrderByColumn(OrderAddressPeer::CREATED_AT);
    981:     }
    982:
    983:     /**
    984:      * Order by create date asc
    985:      *
    986:      * @return     OrderAddressQuery The current query, for fluid interface
    987:      */
    988:     public function firstCreatedFirst()
    989:     {
    990:         return $this->addAscendingOrderByColumn(OrderAddressPeer::CREATED_AT);
    991:     }
    992: }
    993: