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