Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: 
   3: namespace Thelia\Model\om;
   4: 
   5: use \BasePeer;
   6: use \Criteria;
   7: use \PDO;
   8: use \PDOStatement;
   9: use \Propel;
  10: use \PropelException;
  11: use \PropelPDO;
  12: use Thelia\Model\Address;
  13: use Thelia\Model\AddressPeer;
  14: use Thelia\Model\CustomerPeer;
  15: use Thelia\Model\CustomerTitlePeer;
  16: use Thelia\Model\map\AddressTableMap;
  17: 
  18: /**
  19:  * Base static class for performing query and update operations on the 'address' table.
  20:  *
  21:  *
  22:  *
  23:  * @package propel.generator.Thelia.Model.om
  24:  */
  25: abstract class BaseAddressPeer
  26: {
  27: 
  28:     /** the default database name for this class */
  29:     const DATABASE_NAME = 'thelia';
  30: 
  31:     /** the table name for this class */
  32:     const TABLE_NAME = 'address';
  33: 
  34:     /** the related Propel class for this table */
  35:     const OM_CLASS = 'Thelia\\Model\\Address';
  36: 
  37:     /** the related TableMap class for this table */
  38:     const TM_CLASS = 'AddressTableMap';
  39: 
  40:     /** The total number of columns. */
  41:     const NUM_COLUMNS = 16;
  42: 
  43:     /** The number of lazy-loaded columns. */
  44:     const NUM_LAZY_LOAD_COLUMNS = 0;
  45: 
  46:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  47:     const NUM_HYDRATE_COLUMNS = 16;
  48: 
  49:     /** the column name for the ID field */
  50:     const ID = 'address.ID';
  51: 
  52:     /** the column name for the TITLE field */
  53:     const TITLE = 'address.TITLE';
  54: 
  55:     /** the column name for the CUSTOMER_ID field */
  56:     const CUSTOMER_ID = 'address.CUSTOMER_ID';
  57: 
  58:     /** the column name for the CUSTOMER_TITLE_ID field */
  59:     const CUSTOMER_TITLE_ID = 'address.CUSTOMER_TITLE_ID';
  60: 
  61:     /** the column name for the COMPANY field */
  62:     const COMPANY = 'address.COMPANY';
  63: 
  64:     /** the column name for the FIRSTNAME field */
  65:     const FIRSTNAME = 'address.FIRSTNAME';
  66: 
  67:     /** the column name for the LASTNAME field */
  68:     const LASTNAME = 'address.LASTNAME';
  69: 
  70:     /** the column name for the ADDRESS1 field */
  71:     const ADDRESS1 = 'address.ADDRESS1';
  72: 
  73:     /** the column name for the ADDRESS2 field */
  74:     const ADDRESS2 = 'address.ADDRESS2';
  75: 
  76:     /** the column name for the ADDRESS3 field */
  77:     const ADDRESS3 = 'address.ADDRESS3';
  78: 
  79:     /** the column name for the ZIPCODE field */
  80:     const ZIPCODE = 'address.ZIPCODE';
  81: 
  82:     /** the column name for the CITY field */
  83:     const CITY = 'address.CITY';
  84: 
  85:     /** the column name for the COUNTRY_ID field */
  86:     const COUNTRY_ID = 'address.COUNTRY_ID';
  87: 
  88:     /** the column name for the PHONE field */
  89:     const PHONE = 'address.PHONE';
  90: 
  91:     /** the column name for the CREATED_AT field */
  92:     const CREATED_AT = 'address.CREATED_AT';
  93: 
  94:     /** the column name for the UPDATED_AT field */
  95:     const UPDATED_AT = 'address.UPDATED_AT';
  96: 
  97:     /** The default string format for model objects of the related table **/
  98:     const DEFAULT_STRING_FORMAT = 'YAML';
  99: 
 100:     /**
 101:      * An identiy map to hold any loaded instances of Address objects.
 102:      * This must be public so that other peer classes can access this when hydrating from JOIN
 103:      * queries.
 104:      * @var        array Address[]
 105:      */
 106:     public static $instances = array();
 107: 
 108: 
 109:     /**
 110:      * holds an array of fieldnames
 111:      *
 112:      * first dimension keys are the type constants
 113:      * e.g. AddressPeer::$fieldNames[AddressPeer::TYPE_PHPNAME][0] = 'Id'
 114:      */
 115:     protected static $fieldNames = array (
 116:         BasePeer::TYPE_PHPNAME => array ('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'CreatedAt', 'UpdatedAt', ),
 117:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'createdAt', 'updatedAt', ),
 118:         BasePeer::TYPE_COLNAME => array (AddressPeer::ID, AddressPeer::TITLE, AddressPeer::CUSTOMER_ID, AddressPeer::CUSTOMER_TITLE_ID, AddressPeer::COMPANY, AddressPeer::FIRSTNAME, AddressPeer::LASTNAME, AddressPeer::ADDRESS1, AddressPeer::ADDRESS2, AddressPeer::ADDRESS3, AddressPeer::ZIPCODE, AddressPeer::CITY, AddressPeer::COUNTRY_ID, AddressPeer::PHONE, AddressPeer::CREATED_AT, AddressPeer::UPDATED_AT, ),
 119:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CREATED_AT', 'UPDATED_AT', ),
 120:         BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'created_at', 'updated_at', ),
 121:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
 122:     );
 123: 
 124:     /**
 125:      * holds an array of keys for quick access to the fieldnames array
 126:      *
 127:      * first dimension keys are the type constants
 128:      * e.g. AddressPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 129:      */
 130:     protected static $fieldKeys = array (
 131:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
 132:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
 133:         BasePeer::TYPE_COLNAME => array (AddressPeer::ID => 0, AddressPeer::TITLE => 1, AddressPeer::CUSTOMER_ID => 2, AddressPeer::CUSTOMER_TITLE_ID => 3, AddressPeer::COMPANY => 4, AddressPeer::FIRSTNAME => 5, AddressPeer::LASTNAME => 6, AddressPeer::ADDRESS1 => 7, AddressPeer::ADDRESS2 => 8, AddressPeer::ADDRESS3 => 9, AddressPeer::ZIPCODE => 10, AddressPeer::CITY => 11, AddressPeer::COUNTRY_ID => 12, AddressPeer::PHONE => 13, AddressPeer::CREATED_AT => 14, AddressPeer::UPDATED_AT => 15, ),
 134:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
 135:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'created_at' => 14, 'updated_at' => 15, ),
 136:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
 137:     );
 138: 
 139:     /**
 140:      * Translates a fieldname to another type
 141:      *
 142:      * @param      string $name field name
 143:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 144:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 145:      * @param      string $toType   One of the class type constants
 146:      * @return string          translated name of the field.
 147:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 148:      */
 149:     public static function translateFieldName($name, $fromType, $toType)
 150:     {
 151:         $toNames = AddressPeer::getFieldNames($toType);
 152:         $key = isset(AddressPeer::$fieldKeys[$fromType][$name]) ? AddressPeer::$fieldKeys[$fromType][$name] : null;
 153:         if ($key === null) {
 154:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AddressPeer::$fieldKeys[$fromType], true));
 155:         }
 156: 
 157:         return $toNames[$key];
 158:     }
 159: 
 160:     /**
 161:      * Returns an array of field names.
 162:      *
 163:      * @param      string $type The type of fieldnames to return:
 164:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 165:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 166:      * @return array           A list of field names
 167:      * @throws PropelException - if the type is not valid.
 168:      */
 169:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 170:     {
 171:         if (!array_key_exists($type, AddressPeer::$fieldNames)) {
 172:             throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
 173:         }
 174: 
 175:         return AddressPeer::$fieldNames[$type];
 176:     }
 177: 
 178:     /**
 179:      * Convenience method which changes table.column to alias.column.
 180:      *
 181:      * Using this method you can maintain SQL abstraction while using column aliases.
 182:      * <code>
 183:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 184:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 185:      * </code>
 186:      * @param      string $alias The alias for the current table.
 187:      * @param      string $column The column name for current table. (i.e. AddressPeer::COLUMN_NAME).
 188:      * @return string
 189:      */
 190:     public static function alias($alias, $column)
 191:     {
 192:         return str_replace(AddressPeer::TABLE_NAME.'.', $alias.'.', $column);
 193:     }
 194: 
 195:     /**
 196:      * Add all the columns needed to create a new object.
 197:      *
 198:      * Note: any columns that were marked with lazyLoad="true" in the
 199:      * XML schema will not be added to the select list and only loaded
 200:      * on demand.
 201:      *
 202:      * @param      Criteria $criteria object containing the columns to add.
 203:      * @param      string   $alias    optional table alias
 204:      * @throws PropelException Any exceptions caught during processing will be
 205:      *       rethrown wrapped into a PropelException.
 206:      */
 207:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 208:     {
 209:         if (null === $alias) {
 210:             $criteria->addSelectColumn(AddressPeer::ID);
 211:             $criteria->addSelectColumn(AddressPeer::TITLE);
 212:             $criteria->addSelectColumn(AddressPeer::CUSTOMER_ID);
 213:             $criteria->addSelectColumn(AddressPeer::CUSTOMER_TITLE_ID);
 214:             $criteria->addSelectColumn(AddressPeer::COMPANY);
 215:             $criteria->addSelectColumn(AddressPeer::FIRSTNAME);
 216:             $criteria->addSelectColumn(AddressPeer::LASTNAME);
 217:             $criteria->addSelectColumn(AddressPeer::ADDRESS1);
 218:             $criteria->addSelectColumn(AddressPeer::ADDRESS2);
 219:             $criteria->addSelectColumn(AddressPeer::ADDRESS3);
 220:             $criteria->addSelectColumn(AddressPeer::ZIPCODE);
 221:             $criteria->addSelectColumn(AddressPeer::CITY);
 222:             $criteria->addSelectColumn(AddressPeer::COUNTRY_ID);
 223:             $criteria->addSelectColumn(AddressPeer::PHONE);
 224:             $criteria->addSelectColumn(AddressPeer::CREATED_AT);
 225:             $criteria->addSelectColumn(AddressPeer::UPDATED_AT);
 226:         } else {
 227:             $criteria->addSelectColumn($alias . '.ID');
 228:             $criteria->addSelectColumn($alias . '.TITLE');
 229:             $criteria->addSelectColumn($alias . '.CUSTOMER_ID');
 230:             $criteria->addSelectColumn($alias . '.CUSTOMER_TITLE_ID');
 231:             $criteria->addSelectColumn($alias . '.COMPANY');
 232:             $criteria->addSelectColumn($alias . '.FIRSTNAME');
 233:             $criteria->addSelectColumn($alias . '.LASTNAME');
 234:             $criteria->addSelectColumn($alias . '.ADDRESS1');
 235:             $criteria->addSelectColumn($alias . '.ADDRESS2');
 236:             $criteria->addSelectColumn($alias . '.ADDRESS3');
 237:             $criteria->addSelectColumn($alias . '.ZIPCODE');
 238:             $criteria->addSelectColumn($alias . '.CITY');
 239:             $criteria->addSelectColumn($alias . '.COUNTRY_ID');
 240:             $criteria->addSelectColumn($alias . '.PHONE');
 241:             $criteria->addSelectColumn($alias . '.CREATED_AT');
 242:             $criteria->addSelectColumn($alias . '.UPDATED_AT');
 243:         }
 244:     }
 245: 
 246:     /**
 247:      * Returns the number of rows matching criteria.
 248:      *
 249:      * @param      Criteria $criteria
 250:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 251:      * @param      PropelPDO $con
 252:      * @return int Number of matching rows.
 253:      */
 254:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 255:     {
 256:         // we may modify criteria, so copy it first
 257:         $criteria = clone $criteria;
 258: 
 259:         // We need to set the primary table name, since in the case that there are no WHERE columns
 260:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 261:         // tables go into the FROM clause.
 262:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 263: 
 264:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 265:             $criteria->setDistinct();
 266:         }
 267: 
 268:         if (!$criteria->hasSelectClause()) {
 269:             AddressPeer::addSelectColumns($criteria);
 270:         }
 271: 
 272:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 273:         $criteria->setDbName(AddressPeer::DATABASE_NAME); // Set the correct dbName
 274: 
 275:         if ($con === null) {
 276:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 277:         }
 278:         // BasePeer returns a PDOStatement
 279:         $stmt = BasePeer::doCount($criteria, $con);
 280: 
 281:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 282:             $count = (int) $row[0];
 283:         } else {
 284:             $count = 0; // no rows returned; we infer that means 0 matches.
 285:         }
 286:         $stmt->closeCursor();
 287: 
 288:         return $count;
 289:     }
 290:     /**
 291:      * Selects one object from the DB.
 292:      *
 293:      * @param      Criteria $criteria object used to create the SELECT statement.
 294:      * @param      PropelPDO $con
 295:      * @return                 Address
 296:      * @throws PropelException Any exceptions caught during processing will be
 297:      *       rethrown wrapped into a PropelException.
 298:      */
 299:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 300:     {
 301:         $critcopy = clone $criteria;
 302:         $critcopy->setLimit(1);
 303:         $objects = AddressPeer::doSelect($critcopy, $con);
 304:         if ($objects) {
 305:             return $objects[0];
 306:         }
 307: 
 308:         return null;
 309:     }
 310:     /**
 311:      * Selects several row from the DB.
 312:      *
 313:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 314:      * @param      PropelPDO $con
 315:      * @return array           Array of selected Objects
 316:      * @throws PropelException Any exceptions caught during processing will be
 317:      *       rethrown wrapped into a PropelException.
 318:      */
 319:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 320:     {
 321:         return AddressPeer::populateObjects(AddressPeer::doSelectStmt($criteria, $con));
 322:     }
 323:     /**
 324:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 325:      *
 326:      * Use this method directly if you want to work with an executed statement durirectly (for example
 327:      * to perform your own object hydration).
 328:      *
 329:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 330:      * @param      PropelPDO $con The connection to use
 331:      * @throws PropelException Any exceptions caught during processing will be
 332:      *       rethrown wrapped into a PropelException.
 333:      * @return PDOStatement The executed PDOStatement object.
 334:      * @see        BasePeer::doSelect()
 335:      */
 336:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 337:     {
 338:         if ($con === null) {
 339:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 340:         }
 341: 
 342:         if (!$criteria->hasSelectClause()) {
 343:             $criteria = clone $criteria;
 344:             AddressPeer::addSelectColumns($criteria);
 345:         }
 346: 
 347:         // Set the correct dbName
 348:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
 349: 
 350:         // BasePeer returns a PDOStatement
 351:         return BasePeer::doSelect($criteria, $con);
 352:     }
 353:     /**
 354:      * Adds an object to the instance pool.
 355:      *
 356:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 357:      * from the database.  In some cases -- especially when you override doSelect*()
 358:      * methods in your stub classes -- you may need to explicitly add objects
 359:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 360:      * and retrieveByPK*() calls.
 361:      *
 362:      * @param      Address $obj A Address object.
 363:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 364:      */
 365:     public static function addInstanceToPool($obj, $key = null)
 366:     {
 367:         if (Propel::isInstancePoolingEnabled()) {
 368:             if ($key === null) {
 369:                 $key = (string) $obj->getId();
 370:             } // if key === null
 371:             AddressPeer::$instances[$key] = $obj;
 372:         }
 373:     }
 374: 
 375:     /**
 376:      * Removes an object from the instance pool.
 377:      *
 378:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 379:      * from the database.  In some cases -- especially when you override doDelete
 380:      * methods in your stub classes -- you may need to explicitly remove objects
 381:      * from the cache in order to prevent returning objects that no longer exist.
 382:      *
 383:      * @param      mixed $value A Address object or a primary key value.
 384:      *
 385:      * @return void
 386:      * @throws PropelException - if the value is invalid.
 387:      */
 388:     public static function removeInstanceFromPool($value)
 389:     {
 390:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 391:             if (is_object($value) && $value instanceof Address) {
 392:                 $key = (string) $value->getId();
 393:             } elseif (is_scalar($value)) {
 394:                 // assume we've been passed a primary key
 395:                 $key = (string) $value;
 396:             } else {
 397:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Address object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 398:                 throw $e;
 399:             }
 400: 
 401:             unset(AddressPeer::$instances[$key]);
 402:         }
 403:     } // removeInstanceFromPool()
 404: 
 405:     /**
 406:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 407:      *
 408:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 409:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 410:      *
 411:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 412:      * @return   Address Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 413:      * @see        getPrimaryKeyHash()
 414:      */
 415:     public static function getInstanceFromPool($key)
 416:     {
 417:         if (Propel::isInstancePoolingEnabled()) {
 418:             if (isset(AddressPeer::$instances[$key])) {
 419:                 return AddressPeer::$instances[$key];
 420:             }
 421:         }
 422: 
 423:         return null; // just to be explicit
 424:     }
 425: 
 426:     /**
 427:      * Clear the instance pool.
 428:      *
 429:      * @return void
 430:      */
 431:     public static function clearInstancePool()
 432:     {
 433:         AddressPeer::$instances = array();
 434:     }
 435: 
 436:     /**
 437:      * Method to invalidate the instance pool of all tables related to address
 438:      * by a foreign key with ON DELETE CASCADE
 439:      */
 440:     public static function clearRelatedInstancePool()
 441:     {
 442:     }
 443: 
 444:     /**
 445:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 446:      *
 447:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 448:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 449:      *
 450:      * @param      array $row PropelPDO resultset row.
 451:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 452:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 453:      */
 454:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 455:     {
 456:         // If the PK cannot be derived from the row, return null.
 457:         if ($row[$startcol] === null) {
 458:             return null;
 459:         }
 460: 
 461:         return (string) $row[$startcol];
 462:     }
 463: 
 464:     /**
 465:      * Retrieves the primary key from the DB resultset row
 466:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 467:      * a multi-column primary key, an array of the primary key columns will be returned.
 468:      *
 469:      * @param      array $row PropelPDO resultset row.
 470:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 471:      * @return mixed The primary key of the row
 472:      */
 473:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 474:     {
 475: 
 476:         return (int) $row[$startcol];
 477:     }
 478: 
 479:     /**
 480:      * The returned array will contain objects of the default type or
 481:      * objects that inherit from the default.
 482:      *
 483:      * @throws PropelException Any exceptions caught during processing will be
 484:      *       rethrown wrapped into a PropelException.
 485:      */
 486:     public static function populateObjects(PDOStatement $stmt)
 487:     {
 488:         $results = array();
 489: 
 490:         // set the class once to avoid overhead in the loop
 491:         $cls = AddressPeer::getOMClass();
 492:         // populate the object(s)
 493:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 494:             $key = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
 495:             if (null !== ($obj = AddressPeer::getInstanceFromPool($key))) {
 496:                 // We no longer rehydrate the object, since this can cause data loss.
 497:                 // See http://www.propelorm.org/ticket/509
 498:                 // $obj->hydrate($row, 0, true); // rehydrate
 499:                 $results[] = $obj;
 500:             } else {
 501:                 $obj = new $cls();
 502:                 $obj->hydrate($row);
 503:                 $results[] = $obj;
 504:                 AddressPeer::addInstanceToPool($obj, $key);
 505:             } // if key exists
 506:         }
 507:         $stmt->closeCursor();
 508: 
 509:         return $results;
 510:     }
 511:     /**
 512:      * Populates an object of the default type or an object that inherit from the default.
 513:      *
 514:      * @param      array $row PropelPDO resultset row.
 515:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 516:      * @throws PropelException Any exceptions caught during processing will be
 517:      *       rethrown wrapped into a PropelException.
 518:      * @return array (Address object, last column rank)
 519:      */
 520:     public static function populateObject($row, $startcol = 0)
 521:     {
 522:         $key = AddressPeer::getPrimaryKeyHashFromRow($row, $startcol);
 523:         if (null !== ($obj = AddressPeer::getInstanceFromPool($key))) {
 524:             // We no longer rehydrate the object, since this can cause data loss.
 525:             // See http://www.propelorm.org/ticket/509
 526:             // $obj->hydrate($row, $startcol, true); // rehydrate
 527:             $col = $startcol + AddressPeer::NUM_HYDRATE_COLUMNS;
 528:         } else {
 529:             $cls = AddressPeer::OM_CLASS;
 530:             $obj = new $cls();
 531:             $col = $obj->hydrate($row, $startcol);
 532:             AddressPeer::addInstanceToPool($obj, $key);
 533:         }
 534: 
 535:         return array($obj, $col);
 536:     }
 537: 
 538: 
 539:     /**
 540:      * Returns the number of rows matching criteria, joining the related Customer table
 541:      *
 542:      * @param      Criteria $criteria
 543:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 544:      * @param      PropelPDO $con
 545:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 546:      * @return int Number of matching rows.
 547:      */
 548:     public static function doCountJoinCustomer(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 549:     {
 550:         // we're going to modify criteria, so copy it first
 551:         $criteria = clone $criteria;
 552: 
 553:         // We need to set the primary table name, since in the case that there are no WHERE columns
 554:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 555:         // tables go into the FROM clause.
 556:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 557: 
 558:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 559:             $criteria->setDistinct();
 560:         }
 561: 
 562:         if (!$criteria->hasSelectClause()) {
 563:             AddressPeer::addSelectColumns($criteria);
 564:         }
 565: 
 566:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 567: 
 568:         // Set the correct dbName
 569:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
 570: 
 571:         if ($con === null) {
 572:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 573:         }
 574: 
 575:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 576: 
 577:         $stmt = BasePeer::doCount($criteria, $con);
 578: 
 579:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 580:             $count = (int) $row[0];
 581:         } else {
 582:             $count = 0; // no rows returned; we infer that means 0 matches.
 583:         }
 584:         $stmt->closeCursor();
 585: 
 586:         return $count;
 587:     }
 588: 
 589: 
 590:     /**
 591:      * Returns the number of rows matching criteria, joining the related CustomerTitle table
 592:      *
 593:      * @param      Criteria $criteria
 594:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 595:      * @param      PropelPDO $con
 596:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 597:      * @return int Number of matching rows.
 598:      */
 599:     public static function doCountJoinCustomerTitle(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 600:     {
 601:         // we're going to modify criteria, so copy it first
 602:         $criteria = clone $criteria;
 603: 
 604:         // We need to set the primary table name, since in the case that there are no WHERE columns
 605:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 606:         // tables go into the FROM clause.
 607:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 608: 
 609:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 610:             $criteria->setDistinct();
 611:         }
 612: 
 613:         if (!$criteria->hasSelectClause()) {
 614:             AddressPeer::addSelectColumns($criteria);
 615:         }
 616: 
 617:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 618: 
 619:         // Set the correct dbName
 620:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
 621: 
 622:         if ($con === null) {
 623:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 624:         }
 625: 
 626:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 627: 
 628:         $stmt = BasePeer::doCount($criteria, $con);
 629: 
 630:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 631:             $count = (int) $row[0];
 632:         } else {
 633:             $count = 0; // no rows returned; we infer that means 0 matches.
 634:         }
 635:         $stmt->closeCursor();
 636: 
 637:         return $count;
 638:     }
 639: 
 640: 
 641:     /**
 642:      * Selects a collection of Address objects pre-filled with their Customer objects.
 643:      * @param      Criteria  $criteria
 644:      * @param      PropelPDO $con
 645:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 646:      * @return array           Array of Address objects.
 647:      * @throws PropelException Any exceptions caught during processing will be
 648:      *       rethrown wrapped into a PropelException.
 649:      */
 650:     public static function doSelectJoinCustomer(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 651:     {
 652:         $criteria = clone $criteria;
 653: 
 654:         // Set the correct dbName if it has not been overridden
 655:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 656:             $criteria->setDbName(AddressPeer::DATABASE_NAME);
 657:         }
 658: 
 659:         AddressPeer::addSelectColumns($criteria);
 660:         $startcol = AddressPeer::NUM_HYDRATE_COLUMNS;
 661:         CustomerPeer::addSelectColumns($criteria);
 662: 
 663:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 664: 
 665:         $stmt = BasePeer::doSelect($criteria, $con);
 666:         $results = array();
 667: 
 668:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 669:             $key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
 670:             if (null !== ($obj1 = AddressPeer::getInstanceFromPool($key1))) {
 671:                 // We no longer rehydrate the object, since this can cause data loss.
 672:                 // See http://www.propelorm.org/ticket/509
 673:                 // $obj1->hydrate($row, 0, true); // rehydrate
 674:             } else {
 675: 
 676:                 $cls = AddressPeer::getOMClass();
 677: 
 678:                 $obj1 = new $cls();
 679:                 $obj1->hydrate($row);
 680:                 AddressPeer::addInstanceToPool($obj1, $key1);
 681:             } // if $obj1 already loaded
 682: 
 683:             $key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol);
 684:             if ($key2 !== null) {
 685:                 $obj2 = CustomerPeer::getInstanceFromPool($key2);
 686:                 if (!$obj2) {
 687: 
 688:                     $cls = CustomerPeer::getOMClass();
 689: 
 690:                     $obj2 = new $cls();
 691:                     $obj2->hydrate($row, $startcol);
 692:                     CustomerPeer::addInstanceToPool($obj2, $key2);
 693:                 } // if obj2 already loaded
 694: 
 695:                 // Add the $obj1 (Address) to $obj2 (Customer)
 696:                 $obj2->addAddress($obj1);
 697: 
 698:             } // if joined row was not null
 699: 
 700:             $results[] = $obj1;
 701:         }
 702:         $stmt->closeCursor();
 703: 
 704:         return $results;
 705:     }
 706: 
 707: 
 708:     /**
 709:      * Selects a collection of Address objects pre-filled with their CustomerTitle objects.
 710:      * @param      Criteria  $criteria
 711:      * @param      PropelPDO $con
 712:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 713:      * @return array           Array of Address objects.
 714:      * @throws PropelException Any exceptions caught during processing will be
 715:      *       rethrown wrapped into a PropelException.
 716:      */
 717:     public static function doSelectJoinCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 718:     {
 719:         $criteria = clone $criteria;
 720: 
 721:         // Set the correct dbName if it has not been overridden
 722:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 723:             $criteria->setDbName(AddressPeer::DATABASE_NAME);
 724:         }
 725: 
 726:         AddressPeer::addSelectColumns($criteria);
 727:         $startcol = AddressPeer::NUM_HYDRATE_COLUMNS;
 728:         CustomerTitlePeer::addSelectColumns($criteria);
 729: 
 730:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 731: 
 732:         $stmt = BasePeer::doSelect($criteria, $con);
 733:         $results = array();
 734: 
 735:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 736:             $key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
 737:             if (null !== ($obj1 = AddressPeer::getInstanceFromPool($key1))) {
 738:                 // We no longer rehydrate the object, since this can cause data loss.
 739:                 // See http://www.propelorm.org/ticket/509
 740:                 // $obj1->hydrate($row, 0, true); // rehydrate
 741:             } else {
 742: 
 743:                 $cls = AddressPeer::getOMClass();
 744: 
 745:                 $obj1 = new $cls();
 746:                 $obj1->hydrate($row);
 747:                 AddressPeer::addInstanceToPool($obj1, $key1);
 748:             } // if $obj1 already loaded
 749: 
 750:             $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol);
 751:             if ($key2 !== null) {
 752:                 $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
 753:                 if (!$obj2) {
 754: 
 755:                     $cls = CustomerTitlePeer::getOMClass();
 756: 
 757:                     $obj2 = new $cls();
 758:                     $obj2->hydrate($row, $startcol);
 759:                     CustomerTitlePeer::addInstanceToPool($obj2, $key2);
 760:                 } // if obj2 already loaded
 761: 
 762:                 // Add the $obj1 (Address) to $obj2 (CustomerTitle)
 763:                 $obj2->addAddress($obj1);
 764: 
 765:             } // if joined row was not null
 766: 
 767:             $results[] = $obj1;
 768:         }
 769:         $stmt->closeCursor();
 770: 
 771:         return $results;
 772:     }
 773: 
 774: 
 775:     /**
 776:      * Returns the number of rows matching criteria, joining all related tables
 777:      *
 778:      * @param      Criteria $criteria
 779:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 780:      * @param      PropelPDO $con
 781:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 782:      * @return int Number of matching rows.
 783:      */
 784:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 785:     {
 786:         // we're going to modify criteria, so copy it first
 787:         $criteria = clone $criteria;
 788: 
 789:         // We need to set the primary table name, since in the case that there are no WHERE columns
 790:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 791:         // tables go into the FROM clause.
 792:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 793: 
 794:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 795:             $criteria->setDistinct();
 796:         }
 797: 
 798:         if (!$criteria->hasSelectClause()) {
 799:             AddressPeer::addSelectColumns($criteria);
 800:         }
 801: 
 802:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 803: 
 804:         // Set the correct dbName
 805:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
 806: 
 807:         if ($con === null) {
 808:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 809:         }
 810: 
 811:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 812: 
 813:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 814: 
 815:         $stmt = BasePeer::doCount($criteria, $con);
 816: 
 817:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 818:             $count = (int) $row[0];
 819:         } else {
 820:             $count = 0; // no rows returned; we infer that means 0 matches.
 821:         }
 822:         $stmt->closeCursor();
 823: 
 824:         return $count;
 825:     }
 826: 
 827:     /**
 828:      * Selects a collection of Address objects pre-filled with all related objects.
 829:      *
 830:      * @param      Criteria  $criteria
 831:      * @param      PropelPDO $con
 832:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 833:      * @return array           Array of Address objects.
 834:      * @throws PropelException Any exceptions caught during processing will be
 835:      *       rethrown wrapped into a PropelException.
 836:      */
 837:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 838:     {
 839:         $criteria = clone $criteria;
 840: 
 841:         // Set the correct dbName if it has not been overridden
 842:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 843:             $criteria->setDbName(AddressPeer::DATABASE_NAME);
 844:         }
 845: 
 846:         AddressPeer::addSelectColumns($criteria);
 847:         $startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
 848: 
 849:         CustomerPeer::addSelectColumns($criteria);
 850:         $startcol3 = $startcol2 + CustomerPeer::NUM_HYDRATE_COLUMNS;
 851: 
 852:         CustomerTitlePeer::addSelectColumns($criteria);
 853:         $startcol4 = $startcol3 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
 854: 
 855:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 856: 
 857:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 858: 
 859:         $stmt = BasePeer::doSelect($criteria, $con);
 860:         $results = array();
 861: 
 862:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 863:             $key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
 864:             if (null !== ($obj1 = AddressPeer::getInstanceFromPool($key1))) {
 865:                 // We no longer rehydrate the object, since this can cause data loss.
 866:                 // See http://www.propelorm.org/ticket/509
 867:                 // $obj1->hydrate($row, 0, true); // rehydrate
 868:             } else {
 869:                 $cls = AddressPeer::getOMClass();
 870: 
 871:                 $obj1 = new $cls();
 872:                 $obj1->hydrate($row);
 873:                 AddressPeer::addInstanceToPool($obj1, $key1);
 874:             } // if obj1 already loaded
 875: 
 876:             // Add objects for joined Customer rows
 877: 
 878:             $key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol2);
 879:             if ($key2 !== null) {
 880:                 $obj2 = CustomerPeer::getInstanceFromPool($key2);
 881:                 if (!$obj2) {
 882: 
 883:                     $cls = CustomerPeer::getOMClass();
 884: 
 885:                     $obj2 = new $cls();
 886:                     $obj2->hydrate($row, $startcol2);
 887:                     CustomerPeer::addInstanceToPool($obj2, $key2);
 888:                 } // if obj2 loaded
 889: 
 890:                 // Add the $obj1 (Address) to the collection in $obj2 (Customer)
 891:                 $obj2->addAddress($obj1);
 892:             } // if joined row not null
 893: 
 894:             // Add objects for joined CustomerTitle rows
 895: 
 896:             $key3 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol3);
 897:             if ($key3 !== null) {
 898:                 $obj3 = CustomerTitlePeer::getInstanceFromPool($key3);
 899:                 if (!$obj3) {
 900: 
 901:                     $cls = CustomerTitlePeer::getOMClass();
 902: 
 903:                     $obj3 = new $cls();
 904:                     $obj3->hydrate($row, $startcol3);
 905:                     CustomerTitlePeer::addInstanceToPool($obj3, $key3);
 906:                 } // if obj3 loaded
 907: 
 908:                 // Add the $obj1 (Address) to the collection in $obj3 (CustomerTitle)
 909:                 $obj3->addAddress($obj1);
 910:             } // if joined row not null
 911: 
 912:             $results[] = $obj1;
 913:         }
 914:         $stmt->closeCursor();
 915: 
 916:         return $results;
 917:     }
 918: 
 919: 
 920:     /**
 921:      * Returns the number of rows matching criteria, joining the related Customer table
 922:      *
 923:      * @param      Criteria $criteria
 924:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 925:      * @param      PropelPDO $con
 926:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 927:      * @return int Number of matching rows.
 928:      */
 929:     public static function doCountJoinAllExceptCustomer(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 930:     {
 931:         // we're going to modify criteria, so copy it first
 932:         $criteria = clone $criteria;
 933: 
 934:         // We need to set the primary table name, since in the case that there are no WHERE columns
 935:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 936:         // tables go into the FROM clause.
 937:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 938: 
 939:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 940:             $criteria->setDistinct();
 941:         }
 942: 
 943:         if (!$criteria->hasSelectClause()) {
 944:             AddressPeer::addSelectColumns($criteria);
 945:         }
 946: 
 947:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
 948: 
 949:         // Set the correct dbName
 950:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
 951: 
 952:         if ($con === null) {
 953:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 954:         }
 955: 
 956:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 957: 
 958:         $stmt = BasePeer::doCount($criteria, $con);
 959: 
 960:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 961:             $count = (int) $row[0];
 962:         } else {
 963:             $count = 0; // no rows returned; we infer that means 0 matches.
 964:         }
 965:         $stmt->closeCursor();
 966: 
 967:         return $count;
 968:     }
 969: 
 970: 
 971:     /**
 972:      * Returns the number of rows matching criteria, joining the related CustomerTitle table
 973:      *
 974:      * @param      Criteria $criteria
 975:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 976:      * @param      PropelPDO $con
 977:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 978:      * @return int Number of matching rows.
 979:      */
 980:     public static function doCountJoinAllExceptCustomerTitle(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 981:     {
 982:         // we're going to modify criteria, so copy it first
 983:         $criteria = clone $criteria;
 984: 
 985:         // We need to set the primary table name, since in the case that there are no WHERE columns
 986:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 987:         // tables go into the FROM clause.
 988:         $criteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
 989: 
 990:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 991:             $criteria->setDistinct();
 992:         }
 993: 
 994:         if (!$criteria->hasSelectClause()) {
 995:             AddressPeer::addSelectColumns($criteria);
 996:         }
 997: 
 998:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
 999: 
1000:         // Set the correct dbName
1001:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
1002: 
1003:         if ($con === null) {
1004:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1005:         }
1006: 
1007:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1008: 
1009:         $stmt = BasePeer::doCount($criteria, $con);
1010: 
1011:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1012:             $count = (int) $row[0];
1013:         } else {
1014:             $count = 0; // no rows returned; we infer that means 0 matches.
1015:         }
1016:         $stmt->closeCursor();
1017: 
1018:         return $count;
1019:     }
1020: 
1021: 
1022:     /**
1023:      * Selects a collection of Address objects pre-filled with all related objects except Customer.
1024:      *
1025:      * @param      Criteria  $criteria
1026:      * @param      PropelPDO $con
1027:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1028:      * @return array           Array of Address objects.
1029:      * @throws PropelException Any exceptions caught during processing will be
1030:      *       rethrown wrapped into a PropelException.
1031:      */
1032:     public static function doSelectJoinAllExceptCustomer(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1033:     {
1034:         $criteria = clone $criteria;
1035: 
1036:         // Set the correct dbName if it has not been overridden
1037:         // $criteria->getDbName() will return the same object if not set to another value
1038:         // so == check is okay and faster
1039:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1040:             $criteria->setDbName(AddressPeer::DATABASE_NAME);
1041:         }
1042: 
1043:         AddressPeer::addSelectColumns($criteria);
1044:         $startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
1045: 
1046:         CustomerTitlePeer::addSelectColumns($criteria);
1047:         $startcol3 = $startcol2 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
1048: 
1049:         $criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
1050: 
1051: 
1052:         $stmt = BasePeer::doSelect($criteria, $con);
1053:         $results = array();
1054: 
1055:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1056:             $key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
1057:             if (null !== ($obj1 = AddressPeer::getInstanceFromPool($key1))) {
1058:                 // We no longer rehydrate the object, since this can cause data loss.
1059:                 // See http://www.propelorm.org/ticket/509
1060:                 // $obj1->hydrate($row, 0, true); // rehydrate
1061:             } else {
1062:                 $cls = AddressPeer::getOMClass();
1063: 
1064:                 $obj1 = new $cls();
1065:                 $obj1->hydrate($row);
1066:                 AddressPeer::addInstanceToPool($obj1, $key1);
1067:             } // if obj1 already loaded
1068: 
1069:                 // Add objects for joined CustomerTitle rows
1070: 
1071:                 $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol2);
1072:                 if ($key2 !== null) {
1073:                     $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
1074:                     if (!$obj2) {
1075: 
1076:                         $cls = CustomerTitlePeer::getOMClass();
1077: 
1078:                     $obj2 = new $cls();
1079:                     $obj2->hydrate($row, $startcol2);
1080:                     CustomerTitlePeer::addInstanceToPool($obj2, $key2);
1081:                 } // if $obj2 already loaded
1082: 
1083:                 // Add the $obj1 (Address) to the collection in $obj2 (CustomerTitle)
1084:                 $obj2->addAddress($obj1);
1085: 
1086:             } // if joined row is not null
1087: 
1088:             $results[] = $obj1;
1089:         }
1090:         $stmt->closeCursor();
1091: 
1092:         return $results;
1093:     }
1094: 
1095: 
1096:     /**
1097:      * Selects a collection of Address objects pre-filled with all related objects except CustomerTitle.
1098:      *
1099:      * @param      Criteria  $criteria
1100:      * @param      PropelPDO $con
1101:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1102:      * @return array           Array of Address objects.
1103:      * @throws PropelException Any exceptions caught during processing will be
1104:      *       rethrown wrapped into a PropelException.
1105:      */
1106:     public static function doSelectJoinAllExceptCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1107:     {
1108:         $criteria = clone $criteria;
1109: 
1110:         // Set the correct dbName if it has not been overridden
1111:         // $criteria->getDbName() will return the same object if not set to another value
1112:         // so == check is okay and faster
1113:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1114:             $criteria->setDbName(AddressPeer::DATABASE_NAME);
1115:         }
1116: 
1117:         AddressPeer::addSelectColumns($criteria);
1118:         $startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
1119: 
1120:         CustomerPeer::addSelectColumns($criteria);
1121:         $startcol3 = $startcol2 + CustomerPeer::NUM_HYDRATE_COLUMNS;
1122: 
1123:         $criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1124: 
1125: 
1126:         $stmt = BasePeer::doSelect($criteria, $con);
1127:         $results = array();
1128: 
1129:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1130:             $key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
1131:             if (null !== ($obj1 = AddressPeer::getInstanceFromPool($key1))) {
1132:                 // We no longer rehydrate the object, since this can cause data loss.
1133:                 // See http://www.propelorm.org/ticket/509
1134:                 // $obj1->hydrate($row, 0, true); // rehydrate
1135:             } else {
1136:                 $cls = AddressPeer::getOMClass();
1137: 
1138:                 $obj1 = new $cls();
1139:                 $obj1->hydrate($row);
1140:                 AddressPeer::addInstanceToPool($obj1, $key1);
1141:             } // if obj1 already loaded
1142: 
1143:                 // Add objects for joined Customer rows
1144: 
1145:                 $key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1146:                 if ($key2 !== null) {
1147:                     $obj2 = CustomerPeer::getInstanceFromPool($key2);
1148:                     if (!$obj2) {
1149: 
1150:                         $cls = CustomerPeer::getOMClass();
1151: 
1152:                     $obj2 = new $cls();
1153:                     $obj2->hydrate($row, $startcol2);
1154:                     CustomerPeer::addInstanceToPool($obj2, $key2);
1155:                 } // if $obj2 already loaded
1156: 
1157:                 // Add the $obj1 (Address) to the collection in $obj2 (Customer)
1158:                 $obj2->addAddress($obj1);
1159: 
1160:             } // if joined row is not null
1161: 
1162:             $results[] = $obj1;
1163:         }
1164:         $stmt->closeCursor();
1165: 
1166:         return $results;
1167:     }
1168: 
1169:     /**
1170:      * Returns the TableMap related to this peer.
1171:      * This method is not needed for general use but a specific application could have a need.
1172:      * @return TableMap
1173:      * @throws PropelException Any exceptions caught during processing will be
1174:      *       rethrown wrapped into a PropelException.
1175:      */
1176:     public static function getTableMap()
1177:     {
1178:         return Propel::getDatabaseMap(AddressPeer::DATABASE_NAME)->getTable(AddressPeer::TABLE_NAME);
1179:     }
1180: 
1181:     /**
1182:      * Add a TableMap instance to the database for this peer class.
1183:      */
1184:     public static function buildTableMap()
1185:     {
1186:       $dbMap = Propel::getDatabaseMap(BaseAddressPeer::DATABASE_NAME);
1187:       if (!$dbMap->hasTable(BaseAddressPeer::TABLE_NAME)) {
1188:         $dbMap->addTableObject(new AddressTableMap());
1189:       }
1190:     }
1191: 
1192:     /**
1193:      * The class that the Peer will make instances of.
1194:      *
1195:      *
1196:      * @return string ClassName
1197:      */
1198:     public static function getOMClass()
1199:     {
1200:         return AddressPeer::OM_CLASS;
1201:     }
1202: 
1203:     /**
1204:      * Performs an INSERT on the database, given a Address or Criteria object.
1205:      *
1206:      * @param      mixed $values Criteria or Address object containing data that is used to create the INSERT statement.
1207:      * @param      PropelPDO $con the PropelPDO connection to use
1208:      * @return mixed           The new primary key.
1209:      * @throws PropelException Any exceptions caught during processing will be
1210:      *       rethrown wrapped into a PropelException.
1211:      */
1212:     public static function doInsert($values, PropelPDO $con = null)
1213:     {
1214:         if ($con === null) {
1215:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1216:         }
1217: 
1218:         if ($values instanceof Criteria) {
1219:             $criteria = clone $values; // rename for clarity
1220:         } else {
1221:             $criteria = $values->buildCriteria(); // build Criteria from Address object
1222:         }
1223: 
1224:         if ($criteria->containsKey(AddressPeer::ID) && $criteria->keyContainsValue(AddressPeer::ID) ) {
1225:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.AddressPeer::ID.')');
1226:         }
1227: 
1228: 
1229:         // Set the correct dbName
1230:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
1231: 
1232:         try {
1233:             // use transaction because $criteria could contain info
1234:             // for more than one table (I guess, conceivably)
1235:             $con->beginTransaction();
1236:             $pk = BasePeer::doInsert($criteria, $con);
1237:             $con->commit();
1238:         } catch (PropelException $e) {
1239:             $con->rollBack();
1240:             throw $e;
1241:         }
1242: 
1243:         return $pk;
1244:     }
1245: 
1246:     /**
1247:      * Performs an UPDATE on the database, given a Address or Criteria object.
1248:      *
1249:      * @param      mixed $values Criteria or Address object containing data that is used to create the UPDATE statement.
1250:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
1251:      * @return int             The number of affected rows (if supported by underlying database driver).
1252:      * @throws PropelException Any exceptions caught during processing will be
1253:      *       rethrown wrapped into a PropelException.
1254:      */
1255:     public static function doUpdate($values, PropelPDO $con = null)
1256:     {
1257:         if ($con === null) {
1258:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1259:         }
1260: 
1261:         $selectCriteria = new Criteria(AddressPeer::DATABASE_NAME);
1262: 
1263:         if ($values instanceof Criteria) {
1264:             $criteria = clone $values; // rename for clarity
1265: 
1266:             $comparison = $criteria->getComparison(AddressPeer::ID);
1267:             $value = $criteria->remove(AddressPeer::ID);
1268:             if ($value) {
1269:                 $selectCriteria->add(AddressPeer::ID, $value, $comparison);
1270:             } else {
1271:                 $selectCriteria->setPrimaryTableName(AddressPeer::TABLE_NAME);
1272:             }
1273: 
1274:         } else { // $values is Address object
1275:             $criteria = $values->buildCriteria(); // gets full criteria
1276:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
1277:         }
1278: 
1279:         // set the correct dbName
1280:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
1281: 
1282:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
1283:     }
1284: 
1285:     /**
1286:      * Deletes all rows from the address table.
1287:      *
1288:      * @param      PropelPDO $con the connection to use
1289:      * @return int             The number of affected rows (if supported by underlying database driver).
1290:      * @throws PropelException
1291:      */
1292:     public static function doDeleteAll(PropelPDO $con = null)
1293:     {
1294:         if ($con === null) {
1295:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1296:         }
1297:         $affectedRows = 0; // initialize var to track total num of affected rows
1298:         try {
1299:             // use transaction because $criteria could contain info
1300:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
1301:             $con->beginTransaction();
1302:             $affectedRows += BasePeer::doDeleteAll(AddressPeer::TABLE_NAME, $con, AddressPeer::DATABASE_NAME);
1303:             // Because this db requires some delete cascade/set null emulation, we have to
1304:             // clear the cached instance *after* the emulation has happened (since
1305:             // instances get re-added by the select statement contained therein).
1306:             AddressPeer::clearInstancePool();
1307:             AddressPeer::clearRelatedInstancePool();
1308:             $con->commit();
1309: 
1310:             return $affectedRows;
1311:         } catch (PropelException $e) {
1312:             $con->rollBack();
1313:             throw $e;
1314:         }
1315:     }
1316: 
1317:     /**
1318:      * Performs a DELETE on the database, given a Address or Criteria object OR a primary key value.
1319:      *
1320:      * @param      mixed $values Criteria or Address object or primary key or array of primary keys
1321:      *              which is used to create the DELETE statement
1322:      * @param      PropelPDO $con the connection to use
1323:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
1324:      *              if supported by native driver or if emulated using Propel.
1325:      * @throws PropelException Any exceptions caught during processing will be
1326:      *       rethrown wrapped into a PropelException.
1327:      */
1328:      public static function doDelete($values, PropelPDO $con = null)
1329:      {
1330:         if ($con === null) {
1331:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1332:         }
1333: 
1334:         if ($values instanceof Criteria) {
1335:             // invalidate the cache for all objects of this type, since we have no
1336:             // way of knowing (without running a query) what objects should be invalidated
1337:             // from the cache based on this Criteria.
1338:             AddressPeer::clearInstancePool();
1339:             // rename for clarity
1340:             $criteria = clone $values;
1341:         } elseif ($values instanceof Address) { // it's a model object
1342:             // invalidate the cache for this single object
1343:             AddressPeer::removeInstanceFromPool($values);
1344:             // create criteria based on pk values
1345:             $criteria = $values->buildPkeyCriteria();
1346:         } else { // it's a primary key, or an array of pks
1347:             $criteria = new Criteria(AddressPeer::DATABASE_NAME);
1348:             $criteria->add(AddressPeer::ID, (array) $values, Criteria::IN);
1349:             // invalidate the cache for this object(s)
1350:             foreach ((array) $values as $singleval) {
1351:                 AddressPeer::removeInstanceFromPool($singleval);
1352:             }
1353:         }
1354: 
1355:         // Set the correct dbName
1356:         $criteria->setDbName(AddressPeer::DATABASE_NAME);
1357: 
1358:         $affectedRows = 0; // initialize var to track total num of affected rows
1359: 
1360:         try {
1361:             // use transaction because $criteria could contain info
1362:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
1363:             $con->beginTransaction();
1364: 
1365:             $affectedRows += BasePeer::doDelete($criteria, $con);
1366:             AddressPeer::clearRelatedInstancePool();
1367:             $con->commit();
1368: 
1369:             return $affectedRows;
1370:         } catch (PropelException $e) {
1371:             $con->rollBack();
1372:             throw $e;
1373:         }
1374:     }
1375: 
1376:     /**
1377:      * Validates all modified columns of given Address object.
1378:      * If parameter $columns is either a single column name or an array of column names
1379:      * than only those columns are validated.
1380:      *
1381:      * NOTICE: This does not apply to primary or foreign keys for now.
1382:      *
1383:      * @param      Address $obj The object to validate.
1384:      * @param      mixed $cols Column name or array of column names.
1385:      *
1386:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
1387:      */
1388:     public static function doValidate($obj, $cols = null)
1389:     {
1390:         $columns = array();
1391: 
1392:         if ($cols) {
1393:             $dbMap = Propel::getDatabaseMap(AddressPeer::DATABASE_NAME);
1394:             $tableMap = $dbMap->getTable(AddressPeer::TABLE_NAME);
1395: 
1396:             if (! is_array($cols)) {
1397:                 $cols = array($cols);
1398:             }
1399: 
1400:             foreach ($cols as $colName) {
1401:                 if ($tableMap->hasColumn($colName)) {
1402:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1403:                     $columns[$colName] = $obj->$get();
1404:                 }
1405:             }
1406:         } else {
1407: 
1408:         }
1409: 
1410:         return BasePeer::doValidate(AddressPeer::DATABASE_NAME, AddressPeer::TABLE_NAME, $columns);
1411:     }
1412: 
1413:     /**
1414:      * Retrieve a single object by pkey.
1415:      *
1416:      * @param      int $pk the primary key.
1417:      * @param      PropelPDO $con the connection to use
1418:      * @return Address
1419:      */
1420:     public static function retrieveByPK($pk, PropelPDO $con = null)
1421:     {
1422: 
1423:         if (null !== ($obj = AddressPeer::getInstanceFromPool((string) $pk))) {
1424:             return $obj;
1425:         }
1426: 
1427:         if ($con === null) {
1428:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1429:         }
1430: 
1431:         $criteria = new Criteria(AddressPeer::DATABASE_NAME);
1432:         $criteria->add(AddressPeer::ID, $pk);
1433: 
1434:         $v = AddressPeer::doSelect($criteria, $con);
1435: 
1436:         return !empty($v) > 0 ? $v[0] : null;
1437:     }
1438: 
1439:     /**
1440:      * Retrieve multiple objects by pkey.
1441:      *
1442:      * @param      array $pks List of primary keys
1443:      * @param      PropelPDO $con the connection to use
1444:      * @return Address[]
1445:      * @throws PropelException Any exceptions caught during processing will be
1446:      *       rethrown wrapped into a PropelException.
1447:      */
1448:     public static function retrieveByPKs($pks, PropelPDO $con = null)
1449:     {
1450:         if ($con === null) {
1451:             $con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1452:         }
1453: 
1454:         $objs = null;
1455:         if (empty($pks)) {
1456:             $objs = array();
1457:         } else {
1458:             $criteria = new Criteria(AddressPeer::DATABASE_NAME);
1459:             $criteria->add(AddressPeer::ID, $pks, Criteria::IN);
1460:             $objs = AddressPeer::doSelect($criteria, $con);
1461:         }
1462: 
1463:         return $objs;
1464:     }
1465: 
1466: } // BaseAddressPeer
1467: 
1468: // This is the static code needed to register the TableMap for this table with the main Propel class.
1469: //
1470: BaseAddressPeer::buildTableMap();
1471: 
1472: 
thelia API documentation generated by ApiGen 2.8.0