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

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