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