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