Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModule
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseModuleQuery
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • 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\OrderFeature;
  13: use Thelia\Model\OrderFeaturePeer;
  14: use Thelia\Model\OrderProductPeer;
  15: use Thelia\Model\map\OrderFeatureTableMap;
  16: 
  17: /**
  18:  * Base static class for performing query and update operations on the 'order_feature' table.
  19:  *
  20:  *
  21:  *
  22:  * @package propel.generator.Thelia.Model.om
  23:  */
  24: abstract class BaseOrderFeaturePeer
  25: {
  26: 
  27:     /** the default database name for this class */
  28:     const DATABASE_NAME = 'thelia';
  29: 
  30:     /** the table name for this class */
  31:     const TABLE_NAME = 'order_feature';
  32: 
  33:     /** the related Propel class for this table */
  34:     const OM_CLASS = 'Thelia\\Model\\OrderFeature';
  35: 
  36:     /** the related TableMap class for this table */
  37:     const TM_CLASS = 'OrderFeatureTableMap';
  38: 
  39:     /** The total number of columns. */
  40:     const NUM_COLUMNS = 6;
  41: 
  42:     /** The number of lazy-loaded columns. */
  43:     const NUM_LAZY_LOAD_COLUMNS = 0;
  44: 
  45:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  46:     const NUM_HYDRATE_COLUMNS = 6;
  47: 
  48:     /** the column name for the id field */
  49:     const ID = 'order_feature.id';
  50: 
  51:     /** the column name for the order_product_id field */
  52:     const ORDER_PRODUCT_ID = 'order_feature.order_product_id';
  53: 
  54:     /** the column name for the feature_desc field */
  55:     const FEATURE_DESC = 'order_feature.feature_desc';
  56: 
  57:     /** the column name for the feature_av_desc field */
  58:     const FEATURE_AV_DESC = 'order_feature.feature_av_desc';
  59: 
  60:     /** the column name for the created_at field */
  61:     const CREATED_AT = 'order_feature.created_at';
  62: 
  63:     /** the column name for the updated_at field */
  64:     const UPDATED_AT = 'order_feature.updated_at';
  65: 
  66:     /** The default string format for model objects of the related table **/
  67:     const DEFAULT_STRING_FORMAT = 'YAML';
  68: 
  69:     /**
  70:      * An identiy map to hold any loaded instances of OrderFeature objects.
  71:      * This must be public so that other peer classes can access this when hydrating from JOIN
  72:      * queries.
  73:      * @var        array OrderFeature[]
  74:      */
  75:     public static $instances = array();
  76: 
  77: 
  78:     /**
  79:      * holds an array of fieldnames
  80:      *
  81:      * first dimension keys are the type constants
  82:      * e.g. OrderFeaturePeer::$fieldNames[OrderFeaturePeer::TYPE_PHPNAME][0] = 'Id'
  83:      */
  84:     protected static $fieldNames = array (
  85:         BasePeer::TYPE_PHPNAME => array ('Id', 'OrderProductId', 'FeatureDesc', 'FeatureAvDesc', 'CreatedAt', 'UpdatedAt', ),
  86:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'orderProductId', 'featureDesc', 'featureAvDesc', 'createdAt', 'updatedAt', ),
  87:         BasePeer::TYPE_COLNAME => array (OrderFeaturePeer::ID, OrderFeaturePeer::ORDER_PRODUCT_ID, OrderFeaturePeer::FEATURE_DESC, OrderFeaturePeer::FEATURE_AV_DESC, OrderFeaturePeer::CREATED_AT, OrderFeaturePeer::UPDATED_AT, ),
  88:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'ORDER_PRODUCT_ID', 'FEATURE_DESC', 'FEATURE_AV_DESC', 'CREATED_AT', 'UPDATED_AT', ),
  89:         BasePeer::TYPE_FIELDNAME => array ('id', 'order_product_id', 'feature_desc', 'feature_av_desc', 'created_at', 'updated_at', ),
  90:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
  91:     );
  92: 
  93:     /**
  94:      * holds an array of keys for quick access to the fieldnames array
  95:      *
  96:      * first dimension keys are the type constants
  97:      * e.g. OrderFeaturePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  98:      */
  99:     protected static $fieldKeys = array (
 100:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'OrderProductId' => 1, 'FeatureDesc' => 2, 'FeatureAvDesc' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
 101:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'orderProductId' => 1, 'featureDesc' => 2, 'featureAvDesc' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
 102:         BasePeer::TYPE_COLNAME => array (OrderFeaturePeer::ID => 0, OrderFeaturePeer::ORDER_PRODUCT_ID => 1, OrderFeaturePeer::FEATURE_DESC => 2, OrderFeaturePeer::FEATURE_AV_DESC => 3, OrderFeaturePeer::CREATED_AT => 4, OrderFeaturePeer::UPDATED_AT => 5, ),
 103:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'ORDER_PRODUCT_ID' => 1, 'FEATURE_DESC' => 2, 'FEATURE_AV_DESC' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
 104:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'order_product_id' => 1, 'feature_desc' => 2, 'feature_av_desc' => 3, 'created_at' => 4, 'updated_at' => 5, ),
 105:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
 106:     );
 107: 
 108:     /**
 109:      * Translates a fieldname to another type
 110:      *
 111:      * @param      string $name field name
 112:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 113:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 114:      * @param      string $toType   One of the class type constants
 115:      * @return string          translated name of the field.
 116:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 117:      */
 118:     public static function translateFieldName($name, $fromType, $toType)
 119:     {
 120:         $toNames = OrderFeaturePeer::getFieldNames($toType);
 121:         $key = isset(OrderFeaturePeer::$fieldKeys[$fromType][$name]) ? OrderFeaturePeer::$fieldKeys[$fromType][$name] : null;
 122:         if ($key === null) {
 123:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrderFeaturePeer::$fieldKeys[$fromType], true));
 124:         }
 125: 
 126:         return $toNames[$key];
 127:     }
 128: 
 129:     /**
 130:      * Returns an array of field names.
 131:      *
 132:      * @param      string $type The type of fieldnames to return:
 133:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 134:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 135:      * @return array           A list of field names
 136:      * @throws PropelException - if the type is not valid.
 137:      */
 138:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 139:     {
 140:         if (!array_key_exists($type, OrderFeaturePeer::$fieldNames)) {
 141:             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.');
 142:         }
 143: 
 144:         return OrderFeaturePeer::$fieldNames[$type];
 145:     }
 146: 
 147:     /**
 148:      * Convenience method which changes table.column to alias.column.
 149:      *
 150:      * Using this method you can maintain SQL abstraction while using column aliases.
 151:      * <code>
 152:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 153:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 154:      * </code>
 155:      * @param      string $alias The alias for the current table.
 156:      * @param      string $column The column name for current table. (i.e. OrderFeaturePeer::COLUMN_NAME).
 157:      * @return string
 158:      */
 159:     public static function alias($alias, $column)
 160:     {
 161:         return str_replace(OrderFeaturePeer::TABLE_NAME.'.', $alias.'.', $column);
 162:     }
 163: 
 164:     /**
 165:      * Add all the columns needed to create a new object.
 166:      *
 167:      * Note: any columns that were marked with lazyLoad="true" in the
 168:      * XML schema will not be added to the select list and only loaded
 169:      * on demand.
 170:      *
 171:      * @param      Criteria $criteria object containing the columns to add.
 172:      * @param      string   $alias    optional table alias
 173:      * @throws PropelException Any exceptions caught during processing will be
 174:      *       rethrown wrapped into a PropelException.
 175:      */
 176:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 177:     {
 178:         if (null === $alias) {
 179:             $criteria->addSelectColumn(OrderFeaturePeer::ID);
 180:             $criteria->addSelectColumn(OrderFeaturePeer::ORDER_PRODUCT_ID);
 181:             $criteria->addSelectColumn(OrderFeaturePeer::FEATURE_DESC);
 182:             $criteria->addSelectColumn(OrderFeaturePeer::FEATURE_AV_DESC);
 183:             $criteria->addSelectColumn(OrderFeaturePeer::CREATED_AT);
 184:             $criteria->addSelectColumn(OrderFeaturePeer::UPDATED_AT);
 185:         } else {
 186:             $criteria->addSelectColumn($alias . '.id');
 187:             $criteria->addSelectColumn($alias . '.order_product_id');
 188:             $criteria->addSelectColumn($alias . '.feature_desc');
 189:             $criteria->addSelectColumn($alias . '.feature_av_desc');
 190:             $criteria->addSelectColumn($alias . '.created_at');
 191:             $criteria->addSelectColumn($alias . '.updated_at');
 192:         }
 193:     }
 194: 
 195:     /**
 196:      * Returns the number of rows matching criteria.
 197:      *
 198:      * @param      Criteria $criteria
 199:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 200:      * @param      PropelPDO $con
 201:      * @return int Number of matching rows.
 202:      */
 203:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 204:     {
 205:         // we may modify criteria, so copy it first
 206:         $criteria = clone $criteria;
 207: 
 208:         // We need to set the primary table name, since in the case that there are no WHERE columns
 209:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 210:         // tables go into the FROM clause.
 211:         $criteria->setPrimaryTableName(OrderFeaturePeer::TABLE_NAME);
 212: 
 213:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 214:             $criteria->setDistinct();
 215:         }
 216: 
 217:         if (!$criteria->hasSelectClause()) {
 218:             OrderFeaturePeer::addSelectColumns($criteria);
 219:         }
 220: 
 221:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 222:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME); // Set the correct dbName
 223: 
 224:         if ($con === null) {
 225:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 226:         }
 227:         // BasePeer returns a PDOStatement
 228:         $stmt = BasePeer::doCount($criteria, $con);
 229: 
 230:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 231:             $count = (int) $row[0];
 232:         } else {
 233:             $count = 0; // no rows returned; we infer that means 0 matches.
 234:         }
 235:         $stmt->closeCursor();
 236: 
 237:         return $count;
 238:     }
 239:     /**
 240:      * Selects one object from the DB.
 241:      *
 242:      * @param      Criteria $criteria object used to create the SELECT statement.
 243:      * @param      PropelPDO $con
 244:      * @return                 OrderFeature
 245:      * @throws PropelException Any exceptions caught during processing will be
 246:      *       rethrown wrapped into a PropelException.
 247:      */
 248:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 249:     {
 250:         $critcopy = clone $criteria;
 251:         $critcopy->setLimit(1);
 252:         $objects = OrderFeaturePeer::doSelect($critcopy, $con);
 253:         if ($objects) {
 254:             return $objects[0];
 255:         }
 256: 
 257:         return null;
 258:     }
 259:     /**
 260:      * Selects several row from the DB.
 261:      *
 262:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 263:      * @param      PropelPDO $con
 264:      * @return array           Array of selected Objects
 265:      * @throws PropelException Any exceptions caught during processing will be
 266:      *       rethrown wrapped into a PropelException.
 267:      */
 268:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 269:     {
 270:         return OrderFeaturePeer::populateObjects(OrderFeaturePeer::doSelectStmt($criteria, $con));
 271:     }
 272:     /**
 273:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 274:      *
 275:      * Use this method directly if you want to work with an executed statement directly (for example
 276:      * to perform your own object hydration).
 277:      *
 278:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 279:      * @param      PropelPDO $con The connection to use
 280:      * @throws PropelException Any exceptions caught during processing will be
 281:      *       rethrown wrapped into a PropelException.
 282:      * @return PDOStatement The executed PDOStatement object.
 283:      * @see        BasePeer::doSelect()
 284:      */
 285:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 286:     {
 287:         if ($con === null) {
 288:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 289:         }
 290: 
 291:         if (!$criteria->hasSelectClause()) {
 292:             $criteria = clone $criteria;
 293:             OrderFeaturePeer::addSelectColumns($criteria);
 294:         }
 295: 
 296:         // Set the correct dbName
 297:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 298: 
 299:         // BasePeer returns a PDOStatement
 300:         return BasePeer::doSelect($criteria, $con);
 301:     }
 302:     /**
 303:      * Adds an object to the instance pool.
 304:      *
 305:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 306:      * from the database.  In some cases -- especially when you override doSelect*()
 307:      * methods in your stub classes -- you may need to explicitly add objects
 308:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 309:      * and retrieveByPK*() calls.
 310:      *
 311:      * @param      OrderFeature $obj A OrderFeature object.
 312:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 313:      */
 314:     public static function addInstanceToPool($obj, $key = null)
 315:     {
 316:         if (Propel::isInstancePoolingEnabled()) {
 317:             if ($key === null) {
 318:                 $key = (string) $obj->getId();
 319:             } // if key === null
 320:             OrderFeaturePeer::$instances[$key] = $obj;
 321:         }
 322:     }
 323: 
 324:     /**
 325:      * Removes an object from the instance pool.
 326:      *
 327:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 328:      * from the database.  In some cases -- especially when you override doDelete
 329:      * methods in your stub classes -- you may need to explicitly remove objects
 330:      * from the cache in order to prevent returning objects that no longer exist.
 331:      *
 332:      * @param      mixed $value A OrderFeature object or a primary key value.
 333:      *
 334:      * @return void
 335:      * @throws PropelException - if the value is invalid.
 336:      */
 337:     public static function removeInstanceFromPool($value)
 338:     {
 339:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 340:             if (is_object($value) && $value instanceof OrderFeature) {
 341:                 $key = (string) $value->getId();
 342:             } elseif (is_scalar($value)) {
 343:                 // assume we've been passed a primary key
 344:                 $key = (string) $value;
 345:             } else {
 346:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or OrderFeature object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 347:                 throw $e;
 348:             }
 349: 
 350:             unset(OrderFeaturePeer::$instances[$key]);
 351:         }
 352:     } // removeInstanceFromPool()
 353: 
 354:     /**
 355:      * 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.
 356:      *
 357:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 358:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 359:      *
 360:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 361:      * @return   OrderFeature Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 362:      * @see        getPrimaryKeyHash()
 363:      */
 364:     public static function getInstanceFromPool($key)
 365:     {
 366:         if (Propel::isInstancePoolingEnabled()) {
 367:             if (isset(OrderFeaturePeer::$instances[$key])) {
 368:                 return OrderFeaturePeer::$instances[$key];
 369:             }
 370:         }
 371: 
 372:         return null; // just to be explicit
 373:     }
 374: 
 375:     /**
 376:      * Clear the instance pool.
 377:      *
 378:      * @return void
 379:      */
 380:     public static function clearInstancePool($and_clear_all_references = false)
 381:     {
 382:       if ($and_clear_all_references)
 383:       {
 384:         foreach (OrderFeaturePeer::$instances as $instance)
 385:         {
 386:           $instance->clearAllReferences(true);
 387:         }
 388:       }
 389:         OrderFeaturePeer::$instances = array();
 390:     }
 391: 
 392:     /**
 393:      * Method to invalidate the instance pool of all tables related to order_feature
 394:      * by a foreign key with ON DELETE CASCADE
 395:      */
 396:     public static function clearRelatedInstancePool()
 397:     {
 398:     }
 399: 
 400:     /**
 401:      * 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.
 402:      *
 403:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 404:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 405:      *
 406:      * @param      array $row PropelPDO resultset row.
 407:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 408:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 409:      */
 410:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 411:     {
 412:         // If the PK cannot be derived from the row, return null.
 413:         if ($row[$startcol] === null) {
 414:             return null;
 415:         }
 416: 
 417:         return (string) $row[$startcol];
 418:     }
 419: 
 420:     /**
 421:      * Retrieves the primary key from the DB resultset row
 422:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 423:      * a multi-column primary key, an array of the primary key columns will be returned.
 424:      *
 425:      * @param      array $row PropelPDO resultset row.
 426:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 427:      * @return mixed The primary key of the row
 428:      */
 429:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 430:     {
 431: 
 432:         return (int) $row[$startcol];
 433:     }
 434: 
 435:     /**
 436:      * The returned array will contain objects of the default type or
 437:      * objects that inherit from the default.
 438:      *
 439:      * @throws PropelException Any exceptions caught during processing will be
 440:      *       rethrown wrapped into a PropelException.
 441:      */
 442:     public static function populateObjects(PDOStatement $stmt)
 443:     {
 444:         $results = array();
 445: 
 446:         // set the class once to avoid overhead in the loop
 447:         $cls = OrderFeaturePeer::getOMClass();
 448:         // populate the object(s)
 449:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 450:             $key = OrderFeaturePeer::getPrimaryKeyHashFromRow($row, 0);
 451:             if (null !== ($obj = OrderFeaturePeer::getInstanceFromPool($key))) {
 452:                 // We no longer rehydrate the object, since this can cause data loss.
 453:                 // See http://www.propelorm.org/ticket/509
 454:                 // $obj->hydrate($row, 0, true); // rehydrate
 455:                 $results[] = $obj;
 456:             } else {
 457:                 $obj = new $cls();
 458:                 $obj->hydrate($row);
 459:                 $results[] = $obj;
 460:                 OrderFeaturePeer::addInstanceToPool($obj, $key);
 461:             } // if key exists
 462:         }
 463:         $stmt->closeCursor();
 464: 
 465:         return $results;
 466:     }
 467:     /**
 468:      * Populates an object of the default type or an object that inherit from the default.
 469:      *
 470:      * @param      array $row PropelPDO resultset row.
 471:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 472:      * @throws PropelException Any exceptions caught during processing will be
 473:      *       rethrown wrapped into a PropelException.
 474:      * @return array (OrderFeature object, last column rank)
 475:      */
 476:     public static function populateObject($row, $startcol = 0)
 477:     {
 478:         $key = OrderFeaturePeer::getPrimaryKeyHashFromRow($row, $startcol);
 479:         if (null !== ($obj = OrderFeaturePeer::getInstanceFromPool($key))) {
 480:             // We no longer rehydrate the object, since this can cause data loss.
 481:             // See http://www.propelorm.org/ticket/509
 482:             // $obj->hydrate($row, $startcol, true); // rehydrate
 483:             $col = $startcol + OrderFeaturePeer::NUM_HYDRATE_COLUMNS;
 484:         } else {
 485:             $cls = OrderFeaturePeer::OM_CLASS;
 486:             $obj = new $cls();
 487:             $col = $obj->hydrate($row, $startcol);
 488:             OrderFeaturePeer::addInstanceToPool($obj, $key);
 489:         }
 490: 
 491:         return array($obj, $col);
 492:     }
 493: 
 494: 
 495:     /**
 496:      * Returns the number of rows matching criteria, joining the related OrderProduct table
 497:      *
 498:      * @param      Criteria $criteria
 499:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 500:      * @param      PropelPDO $con
 501:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 502:      * @return int Number of matching rows.
 503:      */
 504:     public static function doCountJoinOrderProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 505:     {
 506:         // we're going to modify criteria, so copy it first
 507:         $criteria = clone $criteria;
 508: 
 509:         // We need to set the primary table name, since in the case that there are no WHERE columns
 510:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 511:         // tables go into the FROM clause.
 512:         $criteria->setPrimaryTableName(OrderFeaturePeer::TABLE_NAME);
 513: 
 514:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 515:             $criteria->setDistinct();
 516:         }
 517: 
 518:         if (!$criteria->hasSelectClause()) {
 519:             OrderFeaturePeer::addSelectColumns($criteria);
 520:         }
 521: 
 522:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 523: 
 524:         // Set the correct dbName
 525:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 526: 
 527:         if ($con === null) {
 528:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 529:         }
 530: 
 531:         $criteria->addJoin(OrderFeaturePeer::ORDER_PRODUCT_ID, OrderProductPeer::ID, $join_behavior);
 532: 
 533:         $stmt = BasePeer::doCount($criteria, $con);
 534: 
 535:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 536:             $count = (int) $row[0];
 537:         } else {
 538:             $count = 0; // no rows returned; we infer that means 0 matches.
 539:         }
 540:         $stmt->closeCursor();
 541: 
 542:         return $count;
 543:     }
 544: 
 545: 
 546:     /**
 547:      * Selects a collection of OrderFeature objects pre-filled with their OrderProduct objects.
 548:      * @param      Criteria  $criteria
 549:      * @param      PropelPDO $con
 550:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 551:      * @return array           Array of OrderFeature objects.
 552:      * @throws PropelException Any exceptions caught during processing will be
 553:      *       rethrown wrapped into a PropelException.
 554:      */
 555:     public static function doSelectJoinOrderProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 556:     {
 557:         $criteria = clone $criteria;
 558: 
 559:         // Set the correct dbName if it has not been overridden
 560:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 561:             $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 562:         }
 563: 
 564:         OrderFeaturePeer::addSelectColumns($criteria);
 565:         $startcol = OrderFeaturePeer::NUM_HYDRATE_COLUMNS;
 566:         OrderProductPeer::addSelectColumns($criteria);
 567: 
 568:         $criteria->addJoin(OrderFeaturePeer::ORDER_PRODUCT_ID, OrderProductPeer::ID, $join_behavior);
 569: 
 570:         $stmt = BasePeer::doSelect($criteria, $con);
 571:         $results = array();
 572: 
 573:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 574:             $key1 = OrderFeaturePeer::getPrimaryKeyHashFromRow($row, 0);
 575:             if (null !== ($obj1 = OrderFeaturePeer::getInstanceFromPool($key1))) {
 576:                 // We no longer rehydrate the object, since this can cause data loss.
 577:                 // See http://www.propelorm.org/ticket/509
 578:                 // $obj1->hydrate($row, 0, true); // rehydrate
 579:             } else {
 580: 
 581:                 $cls = OrderFeaturePeer::getOMClass();
 582: 
 583:                 $obj1 = new $cls();
 584:                 $obj1->hydrate($row);
 585:                 OrderFeaturePeer::addInstanceToPool($obj1, $key1);
 586:             } // if $obj1 already loaded
 587: 
 588:             $key2 = OrderProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
 589:             if ($key2 !== null) {
 590:                 $obj2 = OrderProductPeer::getInstanceFromPool($key2);
 591:                 if (!$obj2) {
 592: 
 593:                     $cls = OrderProductPeer::getOMClass();
 594: 
 595:                     $obj2 = new $cls();
 596:                     $obj2->hydrate($row, $startcol);
 597:                     OrderProductPeer::addInstanceToPool($obj2, $key2);
 598:                 } // if obj2 already loaded
 599: 
 600:                 // Add the $obj1 (OrderFeature) to $obj2 (OrderProduct)
 601:                 $obj2->addOrderFeature($obj1);
 602: 
 603:             } // if joined row was not null
 604: 
 605:             $results[] = $obj1;
 606:         }
 607:         $stmt->closeCursor();
 608: 
 609:         return $results;
 610:     }
 611: 
 612: 
 613:     /**
 614:      * Returns the number of rows matching criteria, joining all related tables
 615:      *
 616:      * @param      Criteria $criteria
 617:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 618:      * @param      PropelPDO $con
 619:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 620:      * @return int Number of matching rows.
 621:      */
 622:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 623:     {
 624:         // we're going to modify criteria, so copy it first
 625:         $criteria = clone $criteria;
 626: 
 627:         // We need to set the primary table name, since in the case that there are no WHERE columns
 628:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 629:         // tables go into the FROM clause.
 630:         $criteria->setPrimaryTableName(OrderFeaturePeer::TABLE_NAME);
 631: 
 632:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 633:             $criteria->setDistinct();
 634:         }
 635: 
 636:         if (!$criteria->hasSelectClause()) {
 637:             OrderFeaturePeer::addSelectColumns($criteria);
 638:         }
 639: 
 640:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 641: 
 642:         // Set the correct dbName
 643:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 644: 
 645:         if ($con === null) {
 646:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 647:         }
 648: 
 649:         $criteria->addJoin(OrderFeaturePeer::ORDER_PRODUCT_ID, OrderProductPeer::ID, $join_behavior);
 650: 
 651:         $stmt = BasePeer::doCount($criteria, $con);
 652: 
 653:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 654:             $count = (int) $row[0];
 655:         } else {
 656:             $count = 0; // no rows returned; we infer that means 0 matches.
 657:         }
 658:         $stmt->closeCursor();
 659: 
 660:         return $count;
 661:     }
 662: 
 663:     /**
 664:      * Selects a collection of OrderFeature objects pre-filled with all related objects.
 665:      *
 666:      * @param      Criteria  $criteria
 667:      * @param      PropelPDO $con
 668:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 669:      * @return array           Array of OrderFeature objects.
 670:      * @throws PropelException Any exceptions caught during processing will be
 671:      *       rethrown wrapped into a PropelException.
 672:      */
 673:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 674:     {
 675:         $criteria = clone $criteria;
 676: 
 677:         // Set the correct dbName if it has not been overridden
 678:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 679:             $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 680:         }
 681: 
 682:         OrderFeaturePeer::addSelectColumns($criteria);
 683:         $startcol2 = OrderFeaturePeer::NUM_HYDRATE_COLUMNS;
 684: 
 685:         OrderProductPeer::addSelectColumns($criteria);
 686:         $startcol3 = $startcol2 + OrderProductPeer::NUM_HYDRATE_COLUMNS;
 687: 
 688:         $criteria->addJoin(OrderFeaturePeer::ORDER_PRODUCT_ID, OrderProductPeer::ID, $join_behavior);
 689: 
 690:         $stmt = BasePeer::doSelect($criteria, $con);
 691:         $results = array();
 692: 
 693:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 694:             $key1 = OrderFeaturePeer::getPrimaryKeyHashFromRow($row, 0);
 695:             if (null !== ($obj1 = OrderFeaturePeer::getInstanceFromPool($key1))) {
 696:                 // We no longer rehydrate the object, since this can cause data loss.
 697:                 // See http://www.propelorm.org/ticket/509
 698:                 // $obj1->hydrate($row, 0, true); // rehydrate
 699:             } else {
 700:                 $cls = OrderFeaturePeer::getOMClass();
 701: 
 702:                 $obj1 = new $cls();
 703:                 $obj1->hydrate($row);
 704:                 OrderFeaturePeer::addInstanceToPool($obj1, $key1);
 705:             } // if obj1 already loaded
 706: 
 707:             // Add objects for joined OrderProduct rows
 708: 
 709:             $key2 = OrderProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
 710:             if ($key2 !== null) {
 711:                 $obj2 = OrderProductPeer::getInstanceFromPool($key2);
 712:                 if (!$obj2) {
 713: 
 714:                     $cls = OrderProductPeer::getOMClass();
 715: 
 716:                     $obj2 = new $cls();
 717:                     $obj2->hydrate($row, $startcol2);
 718:                     OrderProductPeer::addInstanceToPool($obj2, $key2);
 719:                 } // if obj2 loaded
 720: 
 721:                 // Add the $obj1 (OrderFeature) to the collection in $obj2 (OrderProduct)
 722:                 $obj2->addOrderFeature($obj1);
 723:             } // if joined row not null
 724: 
 725:             $results[] = $obj1;
 726:         }
 727:         $stmt->closeCursor();
 728: 
 729:         return $results;
 730:     }
 731: 
 732:     /**
 733:      * Returns the TableMap related to this peer.
 734:      * This method is not needed for general use but a specific application could have a need.
 735:      * @return TableMap
 736:      * @throws PropelException Any exceptions caught during processing will be
 737:      *       rethrown wrapped into a PropelException.
 738:      */
 739:     public static function getTableMap()
 740:     {
 741:         return Propel::getDatabaseMap(OrderFeaturePeer::DATABASE_NAME)->getTable(OrderFeaturePeer::TABLE_NAME);
 742:     }
 743: 
 744:     /**
 745:      * Add a TableMap instance to the database for this peer class.
 746:      */
 747:     public static function buildTableMap()
 748:     {
 749:       $dbMap = Propel::getDatabaseMap(BaseOrderFeaturePeer::DATABASE_NAME);
 750:       if (!$dbMap->hasTable(BaseOrderFeaturePeer::TABLE_NAME)) {
 751:         $dbMap->addTableObject(new OrderFeatureTableMap());
 752:       }
 753:     }
 754: 
 755:     /**
 756:      * The class that the Peer will make instances of.
 757:      *
 758:      *
 759:      * @return string ClassName
 760:      */
 761:     public static function getOMClass($row = 0, $colnum = 0)
 762:     {
 763:         return OrderFeaturePeer::OM_CLASS;
 764:     }
 765: 
 766:     /**
 767:      * Performs an INSERT on the database, given a OrderFeature or Criteria object.
 768:      *
 769:      * @param      mixed $values Criteria or OrderFeature object containing data that is used to create the INSERT statement.
 770:      * @param      PropelPDO $con the PropelPDO connection to use
 771:      * @return mixed           The new primary key.
 772:      * @throws PropelException Any exceptions caught during processing will be
 773:      *       rethrown wrapped into a PropelException.
 774:      */
 775:     public static function doInsert($values, PropelPDO $con = null)
 776:     {
 777:         if ($con === null) {
 778:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 779:         }
 780: 
 781:         if ($values instanceof Criteria) {
 782:             $criteria = clone $values; // rename for clarity
 783:         } else {
 784:             $criteria = $values->buildCriteria(); // build Criteria from OrderFeature object
 785:         }
 786: 
 787:         if ($criteria->containsKey(OrderFeaturePeer::ID) && $criteria->keyContainsValue(OrderFeaturePeer::ID) ) {
 788:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderFeaturePeer::ID.')');
 789:         }
 790: 
 791: 
 792:         // Set the correct dbName
 793:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 794: 
 795:         try {
 796:             // use transaction because $criteria could contain info
 797:             // for more than one table (I guess, conceivably)
 798:             $con->beginTransaction();
 799:             $pk = BasePeer::doInsert($criteria, $con);
 800:             $con->commit();
 801:         } catch (PropelException $e) {
 802:             $con->rollBack();
 803:             throw $e;
 804:         }
 805: 
 806:         return $pk;
 807:     }
 808: 
 809:     /**
 810:      * Performs an UPDATE on the database, given a OrderFeature or Criteria object.
 811:      *
 812:      * @param      mixed $values Criteria or OrderFeature object containing data that is used to create the UPDATE statement.
 813:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
 814:      * @return int             The number of affected rows (if supported by underlying database driver).
 815:      * @throws PropelException Any exceptions caught during processing will be
 816:      *       rethrown wrapped into a PropelException.
 817:      */
 818:     public static function doUpdate($values, PropelPDO $con = null)
 819:     {
 820:         if ($con === null) {
 821:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 822:         }
 823: 
 824:         $selectCriteria = new Criteria(OrderFeaturePeer::DATABASE_NAME);
 825: 
 826:         if ($values instanceof Criteria) {
 827:             $criteria = clone $values; // rename for clarity
 828: 
 829:             $comparison = $criteria->getComparison(OrderFeaturePeer::ID);
 830:             $value = $criteria->remove(OrderFeaturePeer::ID);
 831:             if ($value) {
 832:                 $selectCriteria->add(OrderFeaturePeer::ID, $value, $comparison);
 833:             } else {
 834:                 $selectCriteria->setPrimaryTableName(OrderFeaturePeer::TABLE_NAME);
 835:             }
 836: 
 837:         } else { // $values is OrderFeature object
 838:             $criteria = $values->buildCriteria(); // gets full criteria
 839:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
 840:         }
 841: 
 842:         // set the correct dbName
 843:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 844: 
 845:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
 846:     }
 847: 
 848:     /**
 849:      * Deletes all rows from the order_feature table.
 850:      *
 851:      * @param      PropelPDO $con the connection to use
 852:      * @return int             The number of affected rows (if supported by underlying database driver).
 853:      * @throws PropelException
 854:      */
 855:     public static function doDeleteAll(PropelPDO $con = null)
 856:     {
 857:         if ($con === null) {
 858:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 859:         }
 860:         $affectedRows = 0; // initialize var to track total num of affected rows
 861:         try {
 862:             // use transaction because $criteria could contain info
 863:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 864:             $con->beginTransaction();
 865:             $affectedRows += BasePeer::doDeleteAll(OrderFeaturePeer::TABLE_NAME, $con, OrderFeaturePeer::DATABASE_NAME);
 866:             // Because this db requires some delete cascade/set null emulation, we have to
 867:             // clear the cached instance *after* the emulation has happened (since
 868:             // instances get re-added by the select statement contained therein).
 869:             OrderFeaturePeer::clearInstancePool();
 870:             OrderFeaturePeer::clearRelatedInstancePool();
 871:             $con->commit();
 872: 
 873:             return $affectedRows;
 874:         } catch (PropelException $e) {
 875:             $con->rollBack();
 876:             throw $e;
 877:         }
 878:     }
 879: 
 880:     /**
 881:      * Performs a DELETE on the database, given a OrderFeature or Criteria object OR a primary key value.
 882:      *
 883:      * @param      mixed $values Criteria or OrderFeature object or primary key or array of primary keys
 884:      *              which is used to create the DELETE statement
 885:      * @param      PropelPDO $con the connection to use
 886:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
 887:      *              if supported by native driver or if emulated using Propel.
 888:      * @throws PropelException Any exceptions caught during processing will be
 889:      *       rethrown wrapped into a PropelException.
 890:      */
 891:      public static function doDelete($values, PropelPDO $con = null)
 892:      {
 893:         if ($con === null) {
 894:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 895:         }
 896: 
 897:         if ($values instanceof Criteria) {
 898:             // invalidate the cache for all objects of this type, since we have no
 899:             // way of knowing (without running a query) what objects should be invalidated
 900:             // from the cache based on this Criteria.
 901:             OrderFeaturePeer::clearInstancePool();
 902:             // rename for clarity
 903:             $criteria = clone $values;
 904:         } elseif ($values instanceof OrderFeature) { // it's a model object
 905:             // invalidate the cache for this single object
 906:             OrderFeaturePeer::removeInstanceFromPool($values);
 907:             // create criteria based on pk values
 908:             $criteria = $values->buildPkeyCriteria();
 909:         } else { // it's a primary key, or an array of pks
 910:             $criteria = new Criteria(OrderFeaturePeer::DATABASE_NAME);
 911:             $criteria->add(OrderFeaturePeer::ID, (array) $values, Criteria::IN);
 912:             // invalidate the cache for this object(s)
 913:             foreach ((array) $values as $singleval) {
 914:                 OrderFeaturePeer::removeInstanceFromPool($singleval);
 915:             }
 916:         }
 917: 
 918:         // Set the correct dbName
 919:         $criteria->setDbName(OrderFeaturePeer::DATABASE_NAME);
 920: 
 921:         $affectedRows = 0; // initialize var to track total num of affected rows
 922: 
 923:         try {
 924:             // use transaction because $criteria could contain info
 925:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 926:             $con->beginTransaction();
 927: 
 928:             $affectedRows += BasePeer::doDelete($criteria, $con);
 929:             OrderFeaturePeer::clearRelatedInstancePool();
 930:             $con->commit();
 931: 
 932:             return $affectedRows;
 933:         } catch (PropelException $e) {
 934:             $con->rollBack();
 935:             throw $e;
 936:         }
 937:     }
 938: 
 939:     /**
 940:      * Validates all modified columns of given OrderFeature object.
 941:      * If parameter $columns is either a single column name or an array of column names
 942:      * than only those columns are validated.
 943:      *
 944:      * NOTICE: This does not apply to primary or foreign keys for now.
 945:      *
 946:      * @param      OrderFeature $obj The object to validate.
 947:      * @param      mixed $cols Column name or array of column names.
 948:      *
 949:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
 950:      */
 951:     public static function doValidate($obj, $cols = null)
 952:     {
 953:         $columns = array();
 954: 
 955:         if ($cols) {
 956:             $dbMap = Propel::getDatabaseMap(OrderFeaturePeer::DATABASE_NAME);
 957:             $tableMap = $dbMap->getTable(OrderFeaturePeer::TABLE_NAME);
 958: 
 959:             if (! is_array($cols)) {
 960:                 $cols = array($cols);
 961:             }
 962: 
 963:             foreach ($cols as $colName) {
 964:                 if ($tableMap->hasColumn($colName)) {
 965:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
 966:                     $columns[$colName] = $obj->$get();
 967:                 }
 968:             }
 969:         } else {
 970: 
 971:         }
 972: 
 973:         return BasePeer::doValidate(OrderFeaturePeer::DATABASE_NAME, OrderFeaturePeer::TABLE_NAME, $columns);
 974:     }
 975: 
 976:     /**
 977:      * Retrieve a single object by pkey.
 978:      *
 979:      * @param      int $pk the primary key.
 980:      * @param      PropelPDO $con the connection to use
 981:      * @return OrderFeature
 982:      */
 983:     public static function retrieveByPK($pk, PropelPDO $con = null)
 984:     {
 985: 
 986:         if (null !== ($obj = OrderFeaturePeer::getInstanceFromPool((string) $pk))) {
 987:             return $obj;
 988:         }
 989: 
 990:         if ($con === null) {
 991:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 992:         }
 993: 
 994:         $criteria = new Criteria(OrderFeaturePeer::DATABASE_NAME);
 995:         $criteria->add(OrderFeaturePeer::ID, $pk);
 996: 
 997:         $v = OrderFeaturePeer::doSelect($criteria, $con);
 998: 
 999:         return !empty($v) > 0 ? $v[0] : null;
1000:     }
1001: 
1002:     /**
1003:      * Retrieve multiple objects by pkey.
1004:      *
1005:      * @param      array $pks List of primary keys
1006:      * @param      PropelPDO $con the connection to use
1007:      * @return OrderFeature[]
1008:      * @throws PropelException Any exceptions caught during processing will be
1009:      *       rethrown wrapped into a PropelException.
1010:      */
1011:     public static function retrieveByPKs($pks, PropelPDO $con = null)
1012:     {
1013:         if ($con === null) {
1014:             $con = Propel::getConnection(OrderFeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
1015:         }
1016: 
1017:         $objs = null;
1018:         if (empty($pks)) {
1019:             $objs = array();
1020:         } else {
1021:             $criteria = new Criteria(OrderFeaturePeer::DATABASE_NAME);
1022:             $criteria->add(OrderFeaturePeer::ID, $pks, Criteria::IN);
1023:             $objs = OrderFeaturePeer::doSelect($criteria, $con);
1024:         }
1025: 
1026:         return $objs;
1027:     }
1028: 
1029: } // BaseOrderFeaturePeer
1030: 
1031: // This is the static code needed to register the TableMap for this table with the main Propel class.
1032: //
1033: BaseOrderFeaturePeer::buildTableMap();
1034: 
1035: 
thelia API documentation generated by ApiGen 2.8.0