Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

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\OrderAddress;
 13: use Thelia\Model\OrderAddressPeer;
 14: use Thelia\Model\OrderPeer;
 15: use Thelia\Model\map\OrderAddressTableMap;
 16: 
 17: /**
 18:  * Base static class for performing query and update operations on the 'order_address' table.
 19:  *
 20:  *
 21:  *
 22:  * @package propel.generator.Thelia.Model.om
 23:  */
 24: abstract class BaseOrderAddressPeer
 25: {
 26: 
 27:     /** the default database name for this class */
 28:     const DATABASE_NAME = 'thelia';
 29: 
 30:     /** the table name for this class */
 31:     const TABLE_NAME = 'order_address';
 32: 
 33:     /** the related Propel class for this table */
 34:     const OM_CLASS = 'Thelia\\Model\\OrderAddress';
 35: 
 36:     /** the related TableMap class for this table */
 37:     const TM_CLASS = 'OrderAddressTableMap';
 38: 
 39:     /** The total number of columns. */
 40:     const NUM_COLUMNS = 14;
 41: 
 42:     /** The number of lazy-loaded columns. */
 43:     const NUM_LAZY_LOAD_COLUMNS = 0;
 44: 
 45:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
 46:     const NUM_HYDRATE_COLUMNS = 14;
 47: 
 48:     /** the column name for the id field */
 49:     const ID = 'order_address.id';
 50: 
 51:     /** the column name for the customer_title_id field */
 52:     const CUSTOMER_TITLE_ID = 'order_address.customer_title_id';
 53: 
 54:     /** the column name for the company field */
 55:     const COMPANY = 'order_address.company';
 56: 
 57:     /** the column name for the firstname field */
 58:     const FIRSTNAME = 'order_address.firstname';
 59: 
 60:     /** the column name for the lastname field */
 61:     const LASTNAME = 'order_address.lastname';
 62: 
 63:     /** the column name for the address1 field */
 64:     const ADDRESS1 = 'order_address.address1';
 65: 
 66:     /** the column name for the address2 field */
 67:     const ADDRESS2 = 'order_address.address2';
 68: 
 69:     /** the column name for the address3 field */
 70:     const ADDRESS3 = 'order_address.address3';
 71: 
 72:     /** the column name for the zipcode field */
 73:     const ZIPCODE = 'order_address.zipcode';
 74: 
 75:     /** the column name for the city field */
 76:     const CITY = 'order_address.city';
 77: 
 78:     /** the column name for the phone field */
 79:     const PHONE = 'order_address.phone';
 80: 
 81:     /** the column name for the country_id field */
 82:     const COUNTRY_ID = 'order_address.country_id';
 83: 
 84:     /** the column name for the created_at field */
 85:     const CREATED_AT = 'order_address.created_at';
 86: 
 87:     /** the column name for the updated_at field */
 88:     const UPDATED_AT = 'order_address.updated_at';
 89: 
 90:     /** The default string format for model objects of the related table **/
 91:     const DEFAULT_STRING_FORMAT = 'YAML';
 92: 
 93:     /**
 94:      * An identiy map to hold any loaded instances of OrderAddress objects.
 95:      * This must be public so that other peer classes can access this when hydrating from JOIN
 96:      * queries.
 97:      * @var        array OrderAddress[]
 98:      */
 99:     public static $instances = array();
100: 
101: 
102:     /**
103:      * holds an array of fieldnames
104:      *
105:      * first dimension keys are the type constants
106:      * e.g. OrderAddressPeer::$fieldNames[OrderAddressPeer::TYPE_PHPNAME][0] = 'Id'
107:      */
108:     protected static $fieldNames = array (
109:         BasePeer::TYPE_PHPNAME => array ('Id', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'Phone', 'CountryId', 'CreatedAt', 'UpdatedAt', ),
110:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'phone', 'countryId', 'createdAt', 'updatedAt', ),
111:         BasePeer::TYPE_COLNAME => array (OrderAddressPeer::ID, OrderAddressPeer::CUSTOMER_TITLE_ID, OrderAddressPeer::COMPANY, OrderAddressPeer::FIRSTNAME, OrderAddressPeer::LASTNAME, OrderAddressPeer::ADDRESS1, OrderAddressPeer::ADDRESS2, OrderAddressPeer::ADDRESS3, OrderAddressPeer::ZIPCODE, OrderAddressPeer::CITY, OrderAddressPeer::PHONE, OrderAddressPeer::COUNTRY_ID, OrderAddressPeer::CREATED_AT, OrderAddressPeer::UPDATED_AT, ),
112:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'PHONE', 'COUNTRY_ID', 'CREATED_AT', 'UPDATED_AT', ),
113:         BasePeer::TYPE_FIELDNAME => array ('id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'phone', 'country_id', 'created_at', 'updated_at', ),
114:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
115:     );
116: 
117:     /**
118:      * holds an array of keys for quick access to the fieldnames array
119:      *
120:      * first dimension keys are the type constants
121:      * e.g. OrderAddressPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
122:      */
123:     protected static $fieldKeys = array (
124:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'CustomerTitleId' => 1, 'Company' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Address1' => 5, 'Address2' => 6, 'Address3' => 7, 'Zipcode' => 8, 'City' => 9, 'Phone' => 10, 'CountryId' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
125:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'customerTitleId' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'phone' => 10, 'countryId' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
126:         BasePeer::TYPE_COLNAME => array (OrderAddressPeer::ID => 0, OrderAddressPeer::CUSTOMER_TITLE_ID => 1, OrderAddressPeer::COMPANY => 2, OrderAddressPeer::FIRSTNAME => 3, OrderAddressPeer::LASTNAME => 4, OrderAddressPeer::ADDRESS1 => 5, OrderAddressPeer::ADDRESS2 => 6, OrderAddressPeer::ADDRESS3 => 7, OrderAddressPeer::ZIPCODE => 8, OrderAddressPeer::CITY => 9, OrderAddressPeer::PHONE => 10, OrderAddressPeer::COUNTRY_ID => 11, OrderAddressPeer::CREATED_AT => 12, OrderAddressPeer::UPDATED_AT => 13, ),
127:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CUSTOMER_TITLE_ID' => 1, 'COMPANY' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'ADDRESS1' => 5, 'ADDRESS2' => 6, 'ADDRESS3' => 7, 'ZIPCODE' => 8, 'CITY' => 9, 'PHONE' => 10, 'COUNTRY_ID' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
128:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'customer_title_id' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'phone' => 10, 'country_id' => 11, 'created_at' => 12, 'updated_at' => 13, ),
129:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
130:     );
131: 
132:     /**
133:      * Translates a fieldname to another type
134:      *
135:      * @param      string $name field name
136:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
137:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
138:      * @param      string $toType   One of the class type constants
139:      * @return string          translated name of the field.
140:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
141:      */
142:     public static function translateFieldName($name, $fromType, $toType)
143:     {
144:         $toNames = OrderAddressPeer::getFieldNames($toType);
145:         $key = isset(OrderAddressPeer::$fieldKeys[$fromType][$name]) ? OrderAddressPeer::$fieldKeys[$fromType][$name] : null;
146:         if ($key === null) {
147:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrderAddressPeer::$fieldKeys[$fromType], true));
148:         }
149: 
150:         return $toNames[$key];
151:     }
152: 
153:     /**
154:      * Returns an array of field names.
155:      *
156:      * @param      string $type The type of fieldnames to return:
157:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
158:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
159:      * @return array           A list of field names
160:      * @throws PropelException - if the type is not valid.
161:      */
162:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
163:     {
164:         if (!array_key_exists($type, OrderAddressPeer::$fieldNames)) {
165:             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.');
166:         }
167: 
168:         return OrderAddressPeer::$fieldNames[$type];
169:     }
170: 
171:     /**
172:      * Convenience method which changes table.column to alias.column.
173:      *
174:      * Using this method you can maintain SQL abstraction while using column aliases.
175:      * <code>
176:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
177:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
178:      * </code>
179:      * @param      string $alias The alias for the current table.
180:      * @param      string $column The column name for current table. (i.e. OrderAddressPeer::COLUMN_NAME).
181:      * @return string
182:      */
183:     public static function alias($alias, $column)
184:     {
185:         return str_replace(OrderAddressPeer::TABLE_NAME.'.', $alias.'.', $column);
186:     }
187: 
188:     /**
189:      * Add all the columns needed to create a new object.
190:      *
191:      * Note: any columns that were marked with lazyLoad="true" in the
192:      * XML schema will not be added to the select list and only loaded
193:      * on demand.
194:      *
195:      * @param      Criteria $criteria object containing the columns to add.
196:      * @param      string   $alias    optional table alias
197:      * @throws PropelException Any exceptions caught during processing will be
198:      *       rethrown wrapped into a PropelException.
199:      */
200:     public static function addSelectColumns(Criteria $criteria, $alias = null)
201:     {
202:         if (null === $alias) {
203:             $criteria->addSelectColumn(OrderAddressPeer::ID);
204:             $criteria->addSelectColumn(OrderAddressPeer::CUSTOMER_TITLE_ID);
205:             $criteria->addSelectColumn(OrderAddressPeer::COMPANY);
206:             $criteria->addSelectColumn(OrderAddressPeer::FIRSTNAME);
207:             $criteria->addSelectColumn(OrderAddressPeer::LASTNAME);
208:             $criteria->addSelectColumn(OrderAddressPeer::ADDRESS1);
209:             $criteria->addSelectColumn(OrderAddressPeer::ADDRESS2);
210:             $criteria->addSelectColumn(OrderAddressPeer::ADDRESS3);
211:             $criteria->addSelectColumn(OrderAddressPeer::ZIPCODE);
212:             $criteria->addSelectColumn(OrderAddressPeer::CITY);
213:             $criteria->addSelectColumn(OrderAddressPeer::PHONE);
214:             $criteria->addSelectColumn(OrderAddressPeer::COUNTRY_ID);
215:             $criteria->addSelectColumn(OrderAddressPeer::CREATED_AT);
216:             $criteria->addSelectColumn(OrderAddressPeer::UPDATED_AT);
217:         } else {
218:             $criteria->addSelectColumn($alias . '.id');
219:             $criteria->addSelectColumn($alias . '.customer_title_id');
220:             $criteria->addSelectColumn($alias . '.company');
221:             $criteria->addSelectColumn($alias . '.firstname');
222:             $criteria->addSelectColumn($alias . '.lastname');
223:             $criteria->addSelectColumn($alias . '.address1');
224:             $criteria->addSelectColumn($alias . '.address2');
225:             $criteria->addSelectColumn($alias . '.address3');
226:             $criteria->addSelectColumn($alias . '.zipcode');
227:             $criteria->addSelectColumn($alias . '.city');
228:             $criteria->addSelectColumn($alias . '.phone');
229:             $criteria->addSelectColumn($alias . '.country_id');
230:             $criteria->addSelectColumn($alias . '.created_at');
231:             $criteria->addSelectColumn($alias . '.updated_at');
232:         }
233:     }
234: 
235:     /**
236:      * Returns the number of rows matching criteria.
237:      *
238:      * @param      Criteria $criteria
239:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
240:      * @param      PropelPDO $con
241:      * @return int Number of matching rows.
242:      */
243:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
244:     {
245:         // we may modify criteria, so copy it first
246:         $criteria = clone $criteria;
247: 
248:         // We need to set the primary table name, since in the case that there are no WHERE columns
249:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
250:         // tables go into the FROM clause.
251:         $criteria->setPrimaryTableName(OrderAddressPeer::TABLE_NAME);
252: 
253:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
254:             $criteria->setDistinct();
255:         }
256: 
257:         if (!$criteria->hasSelectClause()) {
258:             OrderAddressPeer::addSelectColumns($criteria);
259:         }
260: 
261:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
262:         $criteria->setDbName(OrderAddressPeer::DATABASE_NAME); // Set the correct dbName
263: 
264:         if ($con === null) {
265:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
266:         }
267:         // BasePeer returns a PDOStatement
268:         $stmt = BasePeer::doCount($criteria, $con);
269: 
270:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
271:             $count = (int) $row[0];
272:         } else {
273:             $count = 0; // no rows returned; we infer that means 0 matches.
274:         }
275:         $stmt->closeCursor();
276: 
277:         return $count;
278:     }
279:     /**
280:      * Selects one object from the DB.
281:      *
282:      * @param      Criteria $criteria object used to create the SELECT statement.
283:      * @param      PropelPDO $con
284:      * @return                 OrderAddress
285:      * @throws PropelException Any exceptions caught during processing will be
286:      *       rethrown wrapped into a PropelException.
287:      */
288:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
289:     {
290:         $critcopy = clone $criteria;
291:         $critcopy->setLimit(1);
292:         $objects = OrderAddressPeer::doSelect($critcopy, $con);
293:         if ($objects) {
294:             return $objects[0];
295:         }
296: 
297:         return null;
298:     }
299:     /**
300:      * Selects several row from the DB.
301:      *
302:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
303:      * @param      PropelPDO $con
304:      * @return array           Array of selected Objects
305:      * @throws PropelException Any exceptions caught during processing will be
306:      *       rethrown wrapped into a PropelException.
307:      */
308:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
309:     {
310:         return OrderAddressPeer::populateObjects(OrderAddressPeer::doSelectStmt($criteria, $con));
311:     }
312:     /**
313:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
314:      *
315:      * Use this method directly if you want to work with an executed statement directly (for example
316:      * to perform your own object hydration).
317:      *
318:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
319:      * @param      PropelPDO $con The connection to use
320:      * @throws PropelException Any exceptions caught during processing will be
321:      *       rethrown wrapped into a PropelException.
322:      * @return PDOStatement The executed PDOStatement object.
323:      * @see        BasePeer::doSelect()
324:      */
325:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
326:     {
327:         if ($con === null) {
328:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
329:         }
330: 
331:         if (!$criteria->hasSelectClause()) {
332:             $criteria = clone $criteria;
333:             OrderAddressPeer::addSelectColumns($criteria);
334:         }
335: 
336:         // Set the correct dbName
337:         $criteria->setDbName(OrderAddressPeer::DATABASE_NAME);
338: 
339:         // BasePeer returns a PDOStatement
340:         return BasePeer::doSelect($criteria, $con);
341:     }
342:     /**
343:      * Adds an object to the instance pool.
344:      *
345:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
346:      * from the database.  In some cases -- especially when you override doSelect*()
347:      * methods in your stub classes -- you may need to explicitly add objects
348:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
349:      * and retrieveByPK*() calls.
350:      *
351:      * @param      OrderAddress $obj A OrderAddress object.
352:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
353:      */
354:     public static function addInstanceToPool($obj, $key = null)
355:     {
356:         if (Propel::isInstancePoolingEnabled()) {
357:             if ($key === null) {
358:                 $key = (string) $obj->getId();
359:             } // if key === null
360:             OrderAddressPeer::$instances[$key] = $obj;
361:         }
362:     }
363: 
364:     /**
365:      * Removes an object from the instance pool.
366:      *
367:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
368:      * from the database.  In some cases -- especially when you override doDelete
369:      * methods in your stub classes -- you may need to explicitly remove objects
370:      * from the cache in order to prevent returning objects that no longer exist.
371:      *
372:      * @param      mixed $value A OrderAddress object or a primary key value.
373:      *
374:      * @return void
375:      * @throws PropelException - if the value is invalid.
376:      */
377:     public static function removeInstanceFromPool($value)
378:     {
379:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
380:             if (is_object($value) && $value instanceof OrderAddress) {
381:                 $key = (string) $value->getId();
382:             } elseif (is_scalar($value)) {
383:                 // assume we've been passed a primary key
384:                 $key = (string) $value;
385:             } else {
386:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or OrderAddress object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
387:                 throw $e;
388:             }
389: 
390:             unset(OrderAddressPeer::$instances[$key]);
391:         }
392:     } // removeInstanceFromPool()
393: 
394:     /**
395:      * 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.
396:      *
397:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
398:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
399:      *
400:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
401:      * @return   OrderAddress Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
402:      * @see        getPrimaryKeyHash()
403:      */
404:     public static function getInstanceFromPool($key)
405:     {
406:         if (Propel::isInstancePoolingEnabled()) {
407:             if (isset(OrderAddressPeer::$instances[$key])) {
408:                 return OrderAddressPeer::$instances[$key];
409:             }
410:         }
411: 
412:         return null; // just to be explicit
413:     }
414: 
415:     /**
416:      * Clear the instance pool.
417:      *
418:      * @return void
419:      */
420:     public static function clearInstancePool($and_clear_all_references = false)
421:     {
422:       if ($and_clear_all_references)
423:       {
424:         foreach (OrderAddressPeer::$instances as $instance)
425:         {
426:           $instance->clearAllReferences(true);
427:         }
428:       }
429:         OrderAddressPeer::$instances = array();
430:     }
431: 
432:     /**
433:      * Method to invalidate the instance pool of all tables related to order_address
434:      * by a foreign key with ON DELETE CASCADE
435:      */
436:     public static function clearRelatedInstancePool()
437:     {
438:         // Invalidate objects in OrderPeer instance pool,
439:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
440:         OrderPeer::clearInstancePool();
441:         // Invalidate objects in OrderPeer instance pool,
442:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
443:         OrderPeer::clearInstancePool();
444:     }
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      array $row PropelPDO resultset row.
453:      * @param      int $startcol The 0-based offset for reading from the resultset row.
454:      * @return string A string version of PK or null if the components of primary key in result array are all null.
455:      */
456:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
457:     {
458:         // If the PK cannot be derived from the row, return null.
459:         if ($row[$startcol] === null) {
460:             return null;
461:         }
462: 
463:         return (string) $row[$startcol];
464:     }
465: 
466:     /**
467:      * Retrieves the primary key from the DB resultset row
468:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
469:      * a multi-column primary key, an array of the primary key columns will be returned.
470:      *
471:      * @param      array $row PropelPDO resultset row.
472:      * @param      int $startcol The 0-based offset for reading from the resultset row.
473:      * @return mixed The primary key of the row
474:      */
475:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
476:     {
477: 
478:         return (int) $row[$startcol];
479:     }
480: 
481:     /**
482:      * The returned array will contain objects of the default type or
483:      * objects that inherit from the default.
484:      *
485:      * @throws PropelException Any exceptions caught during processing will be
486:      *       rethrown wrapped into a PropelException.
487:      */
488:     public static function populateObjects(PDOStatement $stmt)
489:     {
490:         $results = array();
491: 
492:         // set the class once to avoid overhead in the loop
493:         $cls = OrderAddressPeer::getOMClass();
494:         // populate the object(s)
495:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
496:             $key = OrderAddressPeer::getPrimaryKeyHashFromRow($row, 0);
497:             if (null !== ($obj = OrderAddressPeer::getInstanceFromPool($key))) {
498:                 // We no longer rehydrate the object, since this can cause data loss.
499:                 // See http://www.propelorm.org/ticket/509
500:                 // $obj->hydrate($row, 0, true); // rehydrate
501:                 $results[] = $obj;
502:             } else {
503:                 $obj = new $cls();
504:                 $obj->hydrate($row);
505:                 $results[] = $obj;
506:                 OrderAddressPeer::addInstanceToPool($obj, $key);
507:             } // if key exists
508:         }
509:         $stmt->closeCursor();
510: 
511:         return $results;
512:     }
513:     /**
514:      * Populates an object of the default type or an object that inherit from the default.
515:      *
516:      * @param      array $row PropelPDO resultset row.
517:      * @param      int $startcol The 0-based offset for reading from the resultset row.
518:      * @throws PropelException Any exceptions caught during processing will be
519:      *       rethrown wrapped into a PropelException.
520:      * @return array (OrderAddress object, last column rank)
521:      */
522:     public static function populateObject($row, $startcol = 0)
523:     {
524:         $key = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol);
525:         if (null !== ($obj = OrderAddressPeer::getInstanceFromPool($key))) {
526:             // We no longer rehydrate the object, since this can cause data loss.
527:             // See http://www.propelorm.org/ticket/509
528:             // $obj->hydrate($row, $startcol, true); // rehydrate
529:             $col = $startcol + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
530:         } else {
531:             $cls = OrderAddressPeer::OM_CLASS;
532:             $obj = new $cls();
533:             $col = $obj->hydrate($row, $startcol);
534:             OrderAddressPeer::addInstanceToPool($obj, $key);
535:         }
536: 
537:         return array($obj, $col);
538:     }
539: 
540:     /**
541:      * Returns the TableMap related to this peer.
542:      * This method is not needed for general use but a specific application could have a need.
543:      * @return TableMap
544:      * @throws PropelException Any exceptions caught during processing will be
545:      *       rethrown wrapped into a PropelException.
546:      */
547:     public static function getTableMap()
548:     {
549:         return Propel::getDatabaseMap(OrderAddressPeer::DATABASE_NAME)->getTable(OrderAddressPeer::TABLE_NAME);
550:     }
551: 
552:     /**
553:      * Add a TableMap instance to the database for this peer class.
554:      */
555:     public static function buildTableMap()
556:     {
557:       $dbMap = Propel::getDatabaseMap(BaseOrderAddressPeer::DATABASE_NAME);
558:       if (!$dbMap->hasTable(BaseOrderAddressPeer::TABLE_NAME)) {
559:         $dbMap->addTableObject(new OrderAddressTableMap());
560:       }
561:     }
562: 
563:     /**
564:      * The class that the Peer will make instances of.
565:      *
566:      *
567:      * @return string ClassName
568:      */
569:     public static function getOMClass($row = 0, $colnum = 0)
570:     {
571:         return OrderAddressPeer::OM_CLASS;
572:     }
573: 
574:     /**
575:      * Performs an INSERT on the database, given a OrderAddress or Criteria object.
576:      *
577:      * @param      mixed $values Criteria or OrderAddress object containing data that is used to create the INSERT statement.
578:      * @param      PropelPDO $con the PropelPDO connection to use
579:      * @return mixed           The new primary key.
580:      * @throws PropelException Any exceptions caught during processing will be
581:      *       rethrown wrapped into a PropelException.
582:      */
583:     public static function doInsert($values, PropelPDO $con = null)
584:     {
585:         if ($con === null) {
586:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
587:         }
588: 
589:         if ($values instanceof Criteria) {
590:             $criteria = clone $values; // rename for clarity
591:         } else {
592:             $criteria = $values->buildCriteria(); // build Criteria from OrderAddress object
593:         }
594: 
595:         if ($criteria->containsKey(OrderAddressPeer::ID) && $criteria->keyContainsValue(OrderAddressPeer::ID) ) {
596:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderAddressPeer::ID.')');
597:         }
598: 
599: 
600:         // Set the correct dbName
601:         $criteria->setDbName(OrderAddressPeer::DATABASE_NAME);
602: 
603:         try {
604:             // use transaction because $criteria could contain info
605:             // for more than one table (I guess, conceivably)
606:             $con->beginTransaction();
607:             $pk = BasePeer::doInsert($criteria, $con);
608:             $con->commit();
609:         } catch (PropelException $e) {
610:             $con->rollBack();
611:             throw $e;
612:         }
613: 
614:         return $pk;
615:     }
616: 
617:     /**
618:      * Performs an UPDATE on the database, given a OrderAddress or Criteria object.
619:      *
620:      * @param      mixed $values Criteria or OrderAddress object containing data that is used to create the UPDATE statement.
621:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
622:      * @return int             The number of affected rows (if supported by underlying database driver).
623:      * @throws PropelException Any exceptions caught during processing will be
624:      *       rethrown wrapped into a PropelException.
625:      */
626:     public static function doUpdate($values, PropelPDO $con = null)
627:     {
628:         if ($con === null) {
629:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
630:         }
631: 
632:         $selectCriteria = new Criteria(OrderAddressPeer::DATABASE_NAME);
633: 
634:         if ($values instanceof Criteria) {
635:             $criteria = clone $values; // rename for clarity
636: 
637:             $comparison = $criteria->getComparison(OrderAddressPeer::ID);
638:             $value = $criteria->remove(OrderAddressPeer::ID);
639:             if ($value) {
640:                 $selectCriteria->add(OrderAddressPeer::ID, $value, $comparison);
641:             } else {
642:                 $selectCriteria->setPrimaryTableName(OrderAddressPeer::TABLE_NAME);
643:             }
644: 
645:         } else { // $values is OrderAddress object
646:             $criteria = $values->buildCriteria(); // gets full criteria
647:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
648:         }
649: 
650:         // set the correct dbName
651:         $criteria->setDbName(OrderAddressPeer::DATABASE_NAME);
652: 
653:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
654:     }
655: 
656:     /**
657:      * Deletes all rows from the order_address table.
658:      *
659:      * @param      PropelPDO $con the connection to use
660:      * @return int             The number of affected rows (if supported by underlying database driver).
661:      * @throws PropelException
662:      */
663:     public static function doDeleteAll(PropelPDO $con = null)
664:     {
665:         if ($con === null) {
666:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
667:         }
668:         $affectedRows = 0; // initialize var to track total num of affected rows
669:         try {
670:             // use transaction because $criteria could contain info
671:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
672:             $con->beginTransaction();
673:             $affectedRows += BasePeer::doDeleteAll(OrderAddressPeer::TABLE_NAME, $con, OrderAddressPeer::DATABASE_NAME);
674:             // Because this db requires some delete cascade/set null emulation, we have to
675:             // clear the cached instance *after* the emulation has happened (since
676:             // instances get re-added by the select statement contained therein).
677:             OrderAddressPeer::clearInstancePool();
678:             OrderAddressPeer::clearRelatedInstancePool();
679:             $con->commit();
680: 
681:             return $affectedRows;
682:         } catch (PropelException $e) {
683:             $con->rollBack();
684:             throw $e;
685:         }
686:     }
687: 
688:     /**
689:      * Performs a DELETE on the database, given a OrderAddress or Criteria object OR a primary key value.
690:      *
691:      * @param      mixed $values Criteria or OrderAddress object or primary key or array of primary keys
692:      *              which is used to create the DELETE statement
693:      * @param      PropelPDO $con the connection to use
694:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
695:      *              if supported by native driver or if emulated using Propel.
696:      * @throws PropelException Any exceptions caught during processing will be
697:      *       rethrown wrapped into a PropelException.
698:      */
699:      public static function doDelete($values, PropelPDO $con = null)
700:      {
701:         if ($con === null) {
702:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
703:         }
704: 
705:         if ($values instanceof Criteria) {
706:             // invalidate the cache for all objects of this type, since we have no
707:             // way of knowing (without running a query) what objects should be invalidated
708:             // from the cache based on this Criteria.
709:             OrderAddressPeer::clearInstancePool();
710:             // rename for clarity
711:             $criteria = clone $values;
712:         } elseif ($values instanceof OrderAddress) { // it's a model object
713:             // invalidate the cache for this single object
714:             OrderAddressPeer::removeInstanceFromPool($values);
715:             // create criteria based on pk values
716:             $criteria = $values->buildPkeyCriteria();
717:         } else { // it's a primary key, or an array of pks
718:             $criteria = new Criteria(OrderAddressPeer::DATABASE_NAME);
719:             $criteria->add(OrderAddressPeer::ID, (array) $values, Criteria::IN);
720:             // invalidate the cache for this object(s)
721:             foreach ((array) $values as $singleval) {
722:                 OrderAddressPeer::removeInstanceFromPool($singleval);
723:             }
724:         }
725: 
726:         // Set the correct dbName
727:         $criteria->setDbName(OrderAddressPeer::DATABASE_NAME);
728: 
729:         $affectedRows = 0; // initialize var to track total num of affected rows
730: 
731:         try {
732:             // use transaction because $criteria could contain info
733:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
734:             $con->beginTransaction();
735: 
736:             $affectedRows += BasePeer::doDelete($criteria, $con);
737:             OrderAddressPeer::clearRelatedInstancePool();
738:             $con->commit();
739: 
740:             return $affectedRows;
741:         } catch (PropelException $e) {
742:             $con->rollBack();
743:             throw $e;
744:         }
745:     }
746: 
747:     /**
748:      * Validates all modified columns of given OrderAddress object.
749:      * If parameter $columns is either a single column name or an array of column names
750:      * than only those columns are validated.
751:      *
752:      * NOTICE: This does not apply to primary or foreign keys for now.
753:      *
754:      * @param      OrderAddress $obj The object to validate.
755:      * @param      mixed $cols Column name or array of column names.
756:      *
757:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
758:      */
759:     public static function doValidate($obj, $cols = null)
760:     {
761:         $columns = array();
762: 
763:         if ($cols) {
764:             $dbMap = Propel::getDatabaseMap(OrderAddressPeer::DATABASE_NAME);
765:             $tableMap = $dbMap->getTable(OrderAddressPeer::TABLE_NAME);
766: 
767:             if (! is_array($cols)) {
768:                 $cols = array($cols);
769:             }
770: 
771:             foreach ($cols as $colName) {
772:                 if ($tableMap->hasColumn($colName)) {
773:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
774:                     $columns[$colName] = $obj->$get();
775:                 }
776:             }
777:         } else {
778: 
779:         }
780: 
781:         return BasePeer::doValidate(OrderAddressPeer::DATABASE_NAME, OrderAddressPeer::TABLE_NAME, $columns);
782:     }
783: 
784:     /**
785:      * Retrieve a single object by pkey.
786:      *
787:      * @param      int $pk the primary key.
788:      * @param      PropelPDO $con the connection to use
789:      * @return OrderAddress
790:      */
791:     public static function retrieveByPK($pk, PropelPDO $con = null)
792:     {
793: 
794:         if (null !== ($obj = OrderAddressPeer::getInstanceFromPool((string) $pk))) {
795:             return $obj;
796:         }
797: 
798:         if ($con === null) {
799:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
800:         }
801: 
802:         $criteria = new Criteria(OrderAddressPeer::DATABASE_NAME);
803:         $criteria->add(OrderAddressPeer::ID, $pk);
804: 
805:         $v = OrderAddressPeer::doSelect($criteria, $con);
806: 
807:         return !empty($v) > 0 ? $v[0] : null;
808:     }
809: 
810:     /**
811:      * Retrieve multiple objects by pkey.
812:      *
813:      * @param      array $pks List of primary keys
814:      * @param      PropelPDO $con the connection to use
815:      * @return OrderAddress[]
816:      * @throws PropelException Any exceptions caught during processing will be
817:      *       rethrown wrapped into a PropelException.
818:      */
819:     public static function retrieveByPKs($pks, PropelPDO $con = null)
820:     {
821:         if ($con === null) {
822:             $con = Propel::getConnection(OrderAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
823:         }
824: 
825:         $objs = null;
826:         if (empty($pks)) {
827:             $objs = array();
828:         } else {
829:             $criteria = new Criteria(OrderAddressPeer::DATABASE_NAME);
830:             $criteria->add(OrderAddressPeer::ID, $pks, Criteria::IN);
831:             $objs = OrderAddressPeer::doSelect($criteria, $con);
832:         }
833: 
834:         return $objs;
835:     }
836: 
837: } // BaseOrderAddressPeer
838: 
839: // This is the static code needed to register the TableMap for this table with the main Propel class.
840: //
841: BaseOrderAddressPeer::buildTableMap();
842: 
843: 
thelia API documentation generated by ApiGen 2.8.0