Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

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