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