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\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 durirectly (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()
 473:     {
 474:         CustomerPeer::$instances = array();
 475:     }
 476: 
 477:     /**
 478:      * Method to invalidate the instance pool of all tables related to customer
 479:      * by a foreign key with ON DELETE CASCADE
 480:      */
 481:     public static function clearRelatedInstancePool()
 482:     {
 483:         // Invalidate objects in AddressPeer instance pool,
 484:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 485:         AddressPeer::clearInstancePool();
 486:         // Invalidate objects in OrderPeer instance pool,
 487:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 488:         OrderPeer::clearInstancePool();
 489:     }
 490: 
 491:     /**
 492:      * 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.
 493:      *
 494:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 495:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 496:      *
 497:      * @param      array $row PropelPDO resultset row.
 498:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 499:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 500:      */
 501:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 502:     {
 503:         // If the PK cannot be derived from the row, return null.
 504:         if ($row[$startcol] === null) {
 505:             return null;
 506:         }
 507: 
 508:         return (string) $row[$startcol];
 509:     }
 510: 
 511:     /**
 512:      * Retrieves the primary key from the DB resultset row
 513:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 514:      * a multi-column primary key, an array of the primary key columns will be returned.
 515:      *
 516:      * @param      array $row PropelPDO resultset row.
 517:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 518:      * @return mixed The primary key of the row
 519:      */
 520:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 521:     {
 522: 
 523:         return (int) $row[$startcol];
 524:     }
 525: 
 526:     /**
 527:      * The returned array will contain objects of the default type or
 528:      * objects that inherit from the default.
 529:      *
 530:      * @throws PropelException Any exceptions caught during processing will be
 531:      *       rethrown wrapped into a PropelException.
 532:      */
 533:     public static function populateObjects(PDOStatement $stmt)
 534:     {
 535:         $results = array();
 536: 
 537:         // set the class once to avoid overhead in the loop
 538:         $cls = CustomerPeer::getOMClass();
 539:         // populate the object(s)
 540:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 541:             $key = CustomerPeer::getPrimaryKeyHashFromRow($row, 0);
 542:             if (null !== ($obj = CustomerPeer::getInstanceFromPool($key))) {
 543:                 // We no longer rehydrate the object, since this can cause data loss.
 544:                 // See http://www.propelorm.org/ticket/509
 545:                 // $obj->hydrate($row, 0, true); // rehydrate
 546:                 $results[] = $obj;
 547:             } else {
 548:                 $obj = new $cls();
 549:                 $obj->hydrate($row);
 550:                 $results[] = $obj;
 551:                 CustomerPeer::addInstanceToPool($obj, $key);
 552:             } // if key exists
 553:         }
 554:         $stmt->closeCursor();
 555: 
 556:         return $results;
 557:     }
 558:     /**
 559:      * Populates an object of the default type or an object that inherit from the default.
 560:      *
 561:      * @param      array $row PropelPDO resultset row.
 562:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 563:      * @throws PropelException Any exceptions caught during processing will be
 564:      *       rethrown wrapped into a PropelException.
 565:      * @return array (Customer object, last column rank)
 566:      */
 567:     public static function populateObject($row, $startcol = 0)
 568:     {
 569:         $key = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol);
 570:         if (null !== ($obj = CustomerPeer::getInstanceFromPool($key))) {
 571:             // We no longer rehydrate the object, since this can cause data loss.
 572:             // See http://www.propelorm.org/ticket/509
 573:             // $obj->hydrate($row, $startcol, true); // rehydrate
 574:             $col = $startcol + CustomerPeer::NUM_HYDRATE_COLUMNS;
 575:         } else {
 576:             $cls = CustomerPeer::OM_CLASS;
 577:             $obj = new $cls();
 578:             $col = $obj->hydrate($row, $startcol);
 579:             CustomerPeer::addInstanceToPool($obj, $key);
 580:         }
 581: 
 582:         return array($obj, $col);
 583:     }
 584: 
 585: 
 586:     /**
 587:      * Returns the number of rows matching criteria, joining the related CustomerTitle table
 588:      *
 589:      * @param      Criteria $criteria
 590:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 591:      * @param      PropelPDO $con
 592:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 593:      * @return int Number of matching rows.
 594:      */
 595:     public static function doCountJoinCustomerTitle(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 596:     {
 597:         // we're going to modify criteria, so copy it first
 598:         $criteria = clone $criteria;
 599: 
 600:         // We need to set the primary table name, since in the case that there are no WHERE columns
 601:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 602:         // tables go into the FROM clause.
 603:         $criteria->setPrimaryTableName(CustomerPeer::TABLE_NAME);
 604: 
 605:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 606:             $criteria->setDistinct();
 607:         }
 608: 
 609:         if (!$criteria->hasSelectClause()) {
 610:             CustomerPeer::addSelectColumns($criteria);
 611:         }
 612: 
 613:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 614: 
 615:         // Set the correct dbName
 616:         $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 617: 
 618:         if ($con === null) {
 619:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 620:         }
 621: 
 622:         $criteria->addJoin(CustomerPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 623: 
 624:         $stmt = BasePeer::doCount($criteria, $con);
 625: 
 626:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 627:             $count = (int) $row[0];
 628:         } else {
 629:             $count = 0; // no rows returned; we infer that means 0 matches.
 630:         }
 631:         $stmt->closeCursor();
 632: 
 633:         return $count;
 634:     }
 635: 
 636: 
 637:     /**
 638:      * Selects a collection of Customer objects pre-filled with their CustomerTitle objects.
 639:      * @param      Criteria  $criteria
 640:      * @param      PropelPDO $con
 641:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 642:      * @return array           Array of Customer objects.
 643:      * @throws PropelException Any exceptions caught during processing will be
 644:      *       rethrown wrapped into a PropelException.
 645:      */
 646:     public static function doSelectJoinCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 647:     {
 648:         $criteria = clone $criteria;
 649: 
 650:         // Set the correct dbName if it has not been overridden
 651:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 652:             $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 653:         }
 654: 
 655:         CustomerPeer::addSelectColumns($criteria);
 656:         $startcol = CustomerPeer::NUM_HYDRATE_COLUMNS;
 657:         CustomerTitlePeer::addSelectColumns($criteria);
 658: 
 659:         $criteria->addJoin(CustomerPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 660: 
 661:         $stmt = BasePeer::doSelect($criteria, $con);
 662:         $results = array();
 663: 
 664:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 665:             $key1 = CustomerPeer::getPrimaryKeyHashFromRow($row, 0);
 666:             if (null !== ($obj1 = CustomerPeer::getInstanceFromPool($key1))) {
 667:                 // We no longer rehydrate the object, since this can cause data loss.
 668:                 // See http://www.propelorm.org/ticket/509
 669:                 // $obj1->hydrate($row, 0, true); // rehydrate
 670:             } else {
 671: 
 672:                 $cls = CustomerPeer::getOMClass();
 673: 
 674:                 $obj1 = new $cls();
 675:                 $obj1->hydrate($row);
 676:                 CustomerPeer::addInstanceToPool($obj1, $key1);
 677:             } // if $obj1 already loaded
 678: 
 679:             $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol);
 680:             if ($key2 !== null) {
 681:                 $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
 682:                 if (!$obj2) {
 683: 
 684:                     $cls = CustomerTitlePeer::getOMClass();
 685: 
 686:                     $obj2 = new $cls();
 687:                     $obj2->hydrate($row, $startcol);
 688:                     CustomerTitlePeer::addInstanceToPool($obj2, $key2);
 689:                 } // if obj2 already loaded
 690: 
 691:                 // Add the $obj1 (Customer) to $obj2 (CustomerTitle)
 692:                 $obj2->addCustomer($obj1);
 693: 
 694:             } // if joined row was not null
 695: 
 696:             $results[] = $obj1;
 697:         }
 698:         $stmt->closeCursor();
 699: 
 700:         return $results;
 701:     }
 702: 
 703: 
 704:     /**
 705:      * Returns the number of rows matching criteria, joining all related tables
 706:      *
 707:      * @param      Criteria $criteria
 708:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 709:      * @param      PropelPDO $con
 710:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 711:      * @return int Number of matching rows.
 712:      */
 713:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 714:     {
 715:         // we're going to modify criteria, so copy it first
 716:         $criteria = clone $criteria;
 717: 
 718:         // We need to set the primary table name, since in the case that there are no WHERE columns
 719:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 720:         // tables go into the FROM clause.
 721:         $criteria->setPrimaryTableName(CustomerPeer::TABLE_NAME);
 722: 
 723:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 724:             $criteria->setDistinct();
 725:         }
 726: 
 727:         if (!$criteria->hasSelectClause()) {
 728:             CustomerPeer::addSelectColumns($criteria);
 729:         }
 730: 
 731:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 732: 
 733:         // Set the correct dbName
 734:         $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 735: 
 736:         if ($con === null) {
 737:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 738:         }
 739: 
 740:         $criteria->addJoin(CustomerPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 741: 
 742:         $stmt = BasePeer::doCount($criteria, $con);
 743: 
 744:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 745:             $count = (int) $row[0];
 746:         } else {
 747:             $count = 0; // no rows returned; we infer that means 0 matches.
 748:         }
 749:         $stmt->closeCursor();
 750: 
 751:         return $count;
 752:     }
 753: 
 754:     /**
 755:      * Selects a collection of Customer objects pre-filled with all related objects.
 756:      *
 757:      * @param      Criteria  $criteria
 758:      * @param      PropelPDO $con
 759:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 760:      * @return array           Array of Customer objects.
 761:      * @throws PropelException Any exceptions caught during processing will be
 762:      *       rethrown wrapped into a PropelException.
 763:      */
 764:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 765:     {
 766:         $criteria = clone $criteria;
 767: 
 768:         // Set the correct dbName if it has not been overridden
 769:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 770:             $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 771:         }
 772: 
 773:         CustomerPeer::addSelectColumns($criteria);
 774:         $startcol2 = CustomerPeer::NUM_HYDRATE_COLUMNS;
 775: 
 776:         CustomerTitlePeer::addSelectColumns($criteria);
 777:         $startcol3 = $startcol2 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
 778: 
 779:         $criteria->addJoin(CustomerPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
 780: 
 781:         $stmt = BasePeer::doSelect($criteria, $con);
 782:         $results = array();
 783: 
 784:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 785:             $key1 = CustomerPeer::getPrimaryKeyHashFromRow($row, 0);
 786:             if (null !== ($obj1 = CustomerPeer::getInstanceFromPool($key1))) {
 787:                 // We no longer rehydrate the object, since this can cause data loss.
 788:                 // See http://www.propelorm.org/ticket/509
 789:                 // $obj1->hydrate($row, 0, true); // rehydrate
 790:             } else {
 791:                 $cls = CustomerPeer::getOMClass();
 792: 
 793:                 $obj1 = new $cls();
 794:                 $obj1->hydrate($row);
 795:                 CustomerPeer::addInstanceToPool($obj1, $key1);
 796:             } // if obj1 already loaded
 797: 
 798:             // Add objects for joined CustomerTitle rows
 799: 
 800:             $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol2);
 801:             if ($key2 !== null) {
 802:                 $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
 803:                 if (!$obj2) {
 804: 
 805:                     $cls = CustomerTitlePeer::getOMClass();
 806: 
 807:                     $obj2 = new $cls();
 808:                     $obj2->hydrate($row, $startcol2);
 809:                     CustomerTitlePeer::addInstanceToPool($obj2, $key2);
 810:                 } // if obj2 loaded
 811: 
 812:                 // Add the $obj1 (Customer) to the collection in $obj2 (CustomerTitle)
 813:                 $obj2->addCustomer($obj1);
 814:             } // if joined row not null
 815: 
 816:             $results[] = $obj1;
 817:         }
 818:         $stmt->closeCursor();
 819: 
 820:         return $results;
 821:     }
 822: 
 823:     /**
 824:      * Returns the TableMap related to this peer.
 825:      * This method is not needed for general use but a specific application could have a need.
 826:      * @return TableMap
 827:      * @throws PropelException Any exceptions caught during processing will be
 828:      *       rethrown wrapped into a PropelException.
 829:      */
 830:     public static function getTableMap()
 831:     {
 832:         return Propel::getDatabaseMap(CustomerPeer::DATABASE_NAME)->getTable(CustomerPeer::TABLE_NAME);
 833:     }
 834: 
 835:     /**
 836:      * Add a TableMap instance to the database for this peer class.
 837:      */
 838:     public static function buildTableMap()
 839:     {
 840:       $dbMap = Propel::getDatabaseMap(BaseCustomerPeer::DATABASE_NAME);
 841:       if (!$dbMap->hasTable(BaseCustomerPeer::TABLE_NAME)) {
 842:         $dbMap->addTableObject(new CustomerTableMap());
 843:       }
 844:     }
 845: 
 846:     /**
 847:      * The class that the Peer will make instances of.
 848:      *
 849:      *
 850:      * @return string ClassName
 851:      */
 852:     public static function getOMClass()
 853:     {
 854:         return CustomerPeer::OM_CLASS;
 855:     }
 856: 
 857:     /**
 858:      * Performs an INSERT on the database, given a Customer or Criteria object.
 859:      *
 860:      * @param      mixed $values Criteria or Customer object containing data that is used to create the INSERT statement.
 861:      * @param      PropelPDO $con the PropelPDO connection to use
 862:      * @return mixed           The new primary key.
 863:      * @throws PropelException Any exceptions caught during processing will be
 864:      *       rethrown wrapped into a PropelException.
 865:      */
 866:     public static function doInsert($values, PropelPDO $con = null)
 867:     {
 868:         if ($con === null) {
 869:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 870:         }
 871: 
 872:         if ($values instanceof Criteria) {
 873:             $criteria = clone $values; // rename for clarity
 874:         } else {
 875:             $criteria = $values->buildCriteria(); // build Criteria from Customer object
 876:         }
 877: 
 878:         if ($criteria->containsKey(CustomerPeer::ID) && $criteria->keyContainsValue(CustomerPeer::ID) ) {
 879:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.CustomerPeer::ID.')');
 880:         }
 881: 
 882: 
 883:         // Set the correct dbName
 884:         $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 885: 
 886:         try {
 887:             // use transaction because $criteria could contain info
 888:             // for more than one table (I guess, conceivably)
 889:             $con->beginTransaction();
 890:             $pk = BasePeer::doInsert($criteria, $con);
 891:             $con->commit();
 892:         } catch (PropelException $e) {
 893:             $con->rollBack();
 894:             throw $e;
 895:         }
 896: 
 897:         return $pk;
 898:     }
 899: 
 900:     /**
 901:      * Performs an UPDATE on the database, given a Customer or Criteria object.
 902:      *
 903:      * @param      mixed $values Criteria or Customer object containing data that is used to create the UPDATE statement.
 904:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
 905:      * @return int             The number of affected rows (if supported by underlying database driver).
 906:      * @throws PropelException Any exceptions caught during processing will be
 907:      *       rethrown wrapped into a PropelException.
 908:      */
 909:     public static function doUpdate($values, PropelPDO $con = null)
 910:     {
 911:         if ($con === null) {
 912:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 913:         }
 914: 
 915:         $selectCriteria = new Criteria(CustomerPeer::DATABASE_NAME);
 916: 
 917:         if ($values instanceof Criteria) {
 918:             $criteria = clone $values; // rename for clarity
 919: 
 920:             $comparison = $criteria->getComparison(CustomerPeer::ID);
 921:             $value = $criteria->remove(CustomerPeer::ID);
 922:             if ($value) {
 923:                 $selectCriteria->add(CustomerPeer::ID, $value, $comparison);
 924:             } else {
 925:                 $selectCriteria->setPrimaryTableName(CustomerPeer::TABLE_NAME);
 926:             }
 927: 
 928:         } else { // $values is Customer object
 929:             $criteria = $values->buildCriteria(); // gets full criteria
 930:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
 931:         }
 932: 
 933:         // set the correct dbName
 934:         $criteria->setDbName(CustomerPeer::DATABASE_NAME);
 935: 
 936:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
 937:     }
 938: 
 939:     /**
 940:      * Deletes all rows from the customer table.
 941:      *
 942:      * @param      PropelPDO $con the connection to use
 943:      * @return int             The number of affected rows (if supported by underlying database driver).
 944:      * @throws PropelException
 945:      */
 946:     public static function doDeleteAll(PropelPDO $con = null)
 947:     {
 948:         if ($con === null) {
 949:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 950:         }
 951:         $affectedRows = 0; // initialize var to track total num of affected rows
 952:         try {
 953:             // use transaction because $criteria could contain info
 954:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 955:             $con->beginTransaction();
 956:             $affectedRows += BasePeer::doDeleteAll(CustomerPeer::TABLE_NAME, $con, CustomerPeer::DATABASE_NAME);
 957:             // Because this db requires some delete cascade/set null emulation, we have to
 958:             // clear the cached instance *after* the emulation has happened (since
 959:             // instances get re-added by the select statement contained therein).
 960:             CustomerPeer::clearInstancePool();
 961:             CustomerPeer::clearRelatedInstancePool();
 962:             $con->commit();
 963: 
 964:             return $affectedRows;
 965:         } catch (PropelException $e) {
 966:             $con->rollBack();
 967:             throw $e;
 968:         }
 969:     }
 970: 
 971:     /**
 972:      * Performs a DELETE on the database, given a Customer or Criteria object OR a primary key value.
 973:      *
 974:      * @param      mixed $values Criteria or Customer object or primary key or array of primary keys
 975:      *              which is used to create the DELETE statement
 976:      * @param      PropelPDO $con the connection to use
 977:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
 978:      *              if supported by native driver or if emulated using Propel.
 979:      * @throws PropelException Any exceptions caught during processing will be
 980:      *       rethrown wrapped into a PropelException.
 981:      */
 982:      public static function doDelete($values, PropelPDO $con = null)
 983:      {
 984:         if ($con === null) {
 985:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 986:         }
 987: 
 988:         if ($values instanceof Criteria) {
 989:             // invalidate the cache for all objects of this type, since we have no
 990:             // way of knowing (without running a query) what objects should be invalidated
 991:             // from the cache based on this Criteria.
 992:             CustomerPeer::clearInstancePool();
 993:             // rename for clarity
 994:             $criteria = clone $values;
 995:         } elseif ($values instanceof Customer) { // it's a model object
 996:             // invalidate the cache for this single object
 997:             CustomerPeer::removeInstanceFromPool($values);
 998:             // create criteria based on pk values
 999:             $criteria = $values->buildPkeyCriteria();
1000:         } else { // it's a primary key, or an array of pks
1001:             $criteria = new Criteria(CustomerPeer::DATABASE_NAME);
1002:             $criteria->add(CustomerPeer::ID, (array) $values, Criteria::IN);
1003:             // invalidate the cache for this object(s)
1004:             foreach ((array) $values as $singleval) {
1005:                 CustomerPeer::removeInstanceFromPool($singleval);
1006:             }
1007:         }
1008: 
1009:         // Set the correct dbName
1010:         $criteria->setDbName(CustomerPeer::DATABASE_NAME);
1011: 
1012:         $affectedRows = 0; // initialize var to track total num of affected rows
1013: 
1014:         try {
1015:             // use transaction because $criteria could contain info
1016:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
1017:             $con->beginTransaction();
1018: 
1019:             $affectedRows += BasePeer::doDelete($criteria, $con);
1020:             CustomerPeer::clearRelatedInstancePool();
1021:             $con->commit();
1022: 
1023:             return $affectedRows;
1024:         } catch (PropelException $e) {
1025:             $con->rollBack();
1026:             throw $e;
1027:         }
1028:     }
1029: 
1030:     /**
1031:      * Validates all modified columns of given Customer object.
1032:      * If parameter $columns is either a single column name or an array of column names
1033:      * than only those columns are validated.
1034:      *
1035:      * NOTICE: This does not apply to primary or foreign keys for now.
1036:      *
1037:      * @param      Customer $obj The object to validate.
1038:      * @param      mixed $cols Column name or array of column names.
1039:      *
1040:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
1041:      */
1042:     public static function doValidate($obj, $cols = null)
1043:     {
1044:         $columns = array();
1045: 
1046:         if ($cols) {
1047:             $dbMap = Propel::getDatabaseMap(CustomerPeer::DATABASE_NAME);
1048:             $tableMap = $dbMap->getTable(CustomerPeer::TABLE_NAME);
1049: 
1050:             if (! is_array($cols)) {
1051:                 $cols = array($cols);
1052:             }
1053: 
1054:             foreach ($cols as $colName) {
1055:                 if ($tableMap->hasColumn($colName)) {
1056:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1057:                     $columns[$colName] = $obj->$get();
1058:                 }
1059:             }
1060:         } else {
1061: 
1062:         }
1063: 
1064:         return BasePeer::doValidate(CustomerPeer::DATABASE_NAME, CustomerPeer::TABLE_NAME, $columns);
1065:     }
1066: 
1067:     /**
1068:      * Retrieve a single object by pkey.
1069:      *
1070:      * @param      int $pk the primary key.
1071:      * @param      PropelPDO $con the connection to use
1072:      * @return Customer
1073:      */
1074:     public static function retrieveByPK($pk, PropelPDO $con = null)
1075:     {
1076: 
1077:         if (null !== ($obj = CustomerPeer::getInstanceFromPool((string) $pk))) {
1078:             return $obj;
1079:         }
1080: 
1081:         if ($con === null) {
1082:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1083:         }
1084: 
1085:         $criteria = new Criteria(CustomerPeer::DATABASE_NAME);
1086:         $criteria->add(CustomerPeer::ID, $pk);
1087: 
1088:         $v = CustomerPeer::doSelect($criteria, $con);
1089: 
1090:         return !empty($v) > 0 ? $v[0] : null;
1091:     }
1092: 
1093:     /**
1094:      * Retrieve multiple objects by pkey.
1095:      *
1096:      * @param      array $pks List of primary keys
1097:      * @param      PropelPDO $con the connection to use
1098:      * @return Customer[]
1099:      * @throws PropelException Any exceptions caught during processing will be
1100:      *       rethrown wrapped into a PropelException.
1101:      */
1102:     public static function retrieveByPKs($pks, PropelPDO $con = null)
1103:     {
1104:         if ($con === null) {
1105:             $con = Propel::getConnection(CustomerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1106:         }
1107: 
1108:         $objs = null;
1109:         if (empty($pks)) {
1110:             $objs = array();
1111:         } else {
1112:             $criteria = new Criteria(CustomerPeer::DATABASE_NAME);
1113:             $criteria->add(CustomerPeer::ID, $pks, Criteria::IN);
1114:             $objs = CustomerPeer::doSelect($criteria, $con);
1115:         }
1116: 
1117:         return $objs;
1118:     }
1119: 
1120: } // BaseCustomerPeer
1121: 
1122: // This is the static code needed to register the TableMap for this table with the main Propel class.
1123: //
1124: BaseCustomerPeer::buildTableMap();
1125: 
1126: 
thelia API documentation generated by ApiGen 2.8.0