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