Overview

Namespaces

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

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModule
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseModuleQuery
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Thelia\Model\om;
  4: 
  5: use \BasePeer;
  6: use \Criteria;
  7: use \PDO;
  8: use \PDOStatement;
  9: use \Propel;
 10: use \PropelException;
 11: use \PropelPDO;
 12: use Thelia\Model\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 directly (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($and_clear_all_references = false)
372:     {
373:       if ($and_clear_all_references)
374:       {
375:         foreach (CombinationPeer::$instances as $instance)
376:         {
377:           $instance->clearAllReferences(true);
378:         }
379:       }
380:         CombinationPeer::$instances = array();
381:     }
382: 
383:     /**
384:      * Method to invalidate the instance pool of all tables related to combination
385:      * by a foreign key with ON DELETE CASCADE
386:      */
387:     public static function clearRelatedInstancePool()
388:     {
389:         // Invalidate objects in AttributeCombinationPeer instance pool,
390:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
391:         AttributeCombinationPeer::clearInstancePool();
392:         // Invalidate objects in StockPeer instance pool,
393:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
394:         StockPeer::clearInstancePool();
395:     }
396: 
397:     /**
398:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
399:      *
400:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
401:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
402:      *
403:      * @param      array $row PropelPDO resultset row.
404:      * @param      int $startcol The 0-based offset for reading from the resultset row.
405:      * @return string A string version of PK or null if the components of primary key in result array are all null.
406:      */
407:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
408:     {
409:         // If the PK cannot be derived from the row, return null.
410:         if ($row[$startcol] === null) {
411:             return null;
412:         }
413: 
414:         return (string) $row[$startcol];
415:     }
416: 
417:     /**
418:      * Retrieves the primary key from the DB resultset row
419:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
420:      * a multi-column primary key, an array of the primary key columns will be returned.
421:      *
422:      * @param      array $row PropelPDO resultset row.
423:      * @param      int $startcol The 0-based offset for reading from the resultset row.
424:      * @return mixed The primary key of the row
425:      */
426:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
427:     {
428: 
429:         return (int) $row[$startcol];
430:     }
431: 
432:     /**
433:      * The returned array will contain objects of the default type or
434:      * objects that inherit from the default.
435:      *
436:      * @throws PropelException Any exceptions caught during processing will be
437:      *       rethrown wrapped into a PropelException.
438:      */
439:     public static function populateObjects(PDOStatement $stmt)
440:     {
441:         $results = array();
442: 
443:         // set the class once to avoid overhead in the loop
444:         $cls = CombinationPeer::getOMClass();
445:         // populate the object(s)
446:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
447:             $key = CombinationPeer::getPrimaryKeyHashFromRow($row, 0);
448:             if (null !== ($obj = CombinationPeer::getInstanceFromPool($key))) {
449:                 // We no longer rehydrate the object, since this can cause data loss.
450:                 // See http://www.propelorm.org/ticket/509
451:                 // $obj->hydrate($row, 0, true); // rehydrate
452:                 $results[] = $obj;
453:             } else {
454:                 $obj = new $cls();
455:                 $obj->hydrate($row);
456:                 $results[] = $obj;
457:                 CombinationPeer::addInstanceToPool($obj, $key);
458:             } // if key exists
459:         }
460:         $stmt->closeCursor();
461: 
462:         return $results;
463:     }
464:     /**
465:      * Populates an object of the default type or an object that inherit from the default.
466:      *
467:      * @param      array $row PropelPDO resultset row.
468:      * @param      int $startcol The 0-based offset for reading from the resultset row.
469:      * @throws PropelException Any exceptions caught during processing will be
470:      *       rethrown wrapped into a PropelException.
471:      * @return array (Combination object, last column rank)
472:      */
473:     public static function populateObject($row, $startcol = 0)
474:     {
475:         $key = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol);
476:         if (null !== ($obj = CombinationPeer::getInstanceFromPool($key))) {
477:             // We no longer rehydrate the object, since this can cause data loss.
478:             // See http://www.propelorm.org/ticket/509
479:             // $obj->hydrate($row, $startcol, true); // rehydrate
480:             $col = $startcol + CombinationPeer::NUM_HYDRATE_COLUMNS;
481:         } else {
482:             $cls = CombinationPeer::OM_CLASS;
483:             $obj = new $cls();
484:             $col = $obj->hydrate($row, $startcol);
485:             CombinationPeer::addInstanceToPool($obj, $key);
486:         }
487: 
488:         return array($obj, $col);
489:     }
490: 
491:     /**
492:      * Returns the TableMap related to this peer.
493:      * This method is not needed for general use but a specific application could have a need.
494:      * @return TableMap
495:      * @throws PropelException Any exceptions caught during processing will be
496:      *       rethrown wrapped into a PropelException.
497:      */
498:     public static function getTableMap()
499:     {
500:         return Propel::getDatabaseMap(CombinationPeer::DATABASE_NAME)->getTable(CombinationPeer::TABLE_NAME);
501:     }
502: 
503:     /**
504:      * Add a TableMap instance to the database for this peer class.
505:      */
506:     public static function buildTableMap()
507:     {
508:       $dbMap = Propel::getDatabaseMap(BaseCombinationPeer::DATABASE_NAME);
509:       if (!$dbMap->hasTable(BaseCombinationPeer::TABLE_NAME)) {
510:         $dbMap->addTableObject(new CombinationTableMap());
511:       }
512:     }
513: 
514:     /**
515:      * The class that the Peer will make instances of.
516:      *
517:      *
518:      * @return string ClassName
519:      */
520:     public static function getOMClass($row = 0, $colnum = 0)
521:     {
522:         return CombinationPeer::OM_CLASS;
523:     }
524: 
525:     /**
526:      * Performs an INSERT on the database, given a Combination or Criteria object.
527:      *
528:      * @param      mixed $values Criteria or Combination object containing data that is used to create the INSERT statement.
529:      * @param      PropelPDO $con the PropelPDO connection to use
530:      * @return mixed           The new primary key.
531:      * @throws PropelException Any exceptions caught during processing will be
532:      *       rethrown wrapped into a PropelException.
533:      */
534:     public static function doInsert($values, PropelPDO $con = null)
535:     {
536:         if ($con === null) {
537:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
538:         }
539: 
540:         if ($values instanceof Criteria) {
541:             $criteria = clone $values; // rename for clarity
542:         } else {
543:             $criteria = $values->buildCriteria(); // build Criteria from Combination object
544:         }
545: 
546:         if ($criteria->containsKey(CombinationPeer::ID) && $criteria->keyContainsValue(CombinationPeer::ID) ) {
547:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.CombinationPeer::ID.')');
548:         }
549: 
550: 
551:         // Set the correct dbName
552:         $criteria->setDbName(CombinationPeer::DATABASE_NAME);
553: 
554:         try {
555:             // use transaction because $criteria could contain info
556:             // for more than one table (I guess, conceivably)
557:             $con->beginTransaction();
558:             $pk = BasePeer::doInsert($criteria, $con);
559:             $con->commit();
560:         } catch (PropelException $e) {
561:             $con->rollBack();
562:             throw $e;
563:         }
564: 
565:         return $pk;
566:     }
567: 
568:     /**
569:      * Performs an UPDATE on the database, given a Combination or Criteria object.
570:      *
571:      * @param      mixed $values Criteria or Combination object containing data that is used to create the UPDATE statement.
572:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
573:      * @return int             The number of affected rows (if supported by underlying database driver).
574:      * @throws PropelException Any exceptions caught during processing will be
575:      *       rethrown wrapped into a PropelException.
576:      */
577:     public static function doUpdate($values, PropelPDO $con = null)
578:     {
579:         if ($con === null) {
580:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
581:         }
582: 
583:         $selectCriteria = new Criteria(CombinationPeer::DATABASE_NAME);
584: 
585:         if ($values instanceof Criteria) {
586:             $criteria = clone $values; // rename for clarity
587: 
588:             $comparison = $criteria->getComparison(CombinationPeer::ID);
589:             $value = $criteria->remove(CombinationPeer::ID);
590:             if ($value) {
591:                 $selectCriteria->add(CombinationPeer::ID, $value, $comparison);
592:             } else {
593:                 $selectCriteria->setPrimaryTableName(CombinationPeer::TABLE_NAME);
594:             }
595: 
596:         } else { // $values is Combination object
597:             $criteria = $values->buildCriteria(); // gets full criteria
598:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
599:         }
600: 
601:         // set the correct dbName
602:         $criteria->setDbName(CombinationPeer::DATABASE_NAME);
603: 
604:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
605:     }
606: 
607:     /**
608:      * Deletes all rows from the combination table.
609:      *
610:      * @param      PropelPDO $con the connection to use
611:      * @return int             The number of affected rows (if supported by underlying database driver).
612:      * @throws PropelException
613:      */
614:     public static function doDeleteAll(PropelPDO $con = null)
615:     {
616:         if ($con === null) {
617:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
618:         }
619:         $affectedRows = 0; // initialize var to track total num of affected rows
620:         try {
621:             // use transaction because $criteria could contain info
622:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
623:             $con->beginTransaction();
624:             $affectedRows += BasePeer::doDeleteAll(CombinationPeer::TABLE_NAME, $con, CombinationPeer::DATABASE_NAME);
625:             // Because this db requires some delete cascade/set null emulation, we have to
626:             // clear the cached instance *after* the emulation has happened (since
627:             // instances get re-added by the select statement contained therein).
628:             CombinationPeer::clearInstancePool();
629:             CombinationPeer::clearRelatedInstancePool();
630:             $con->commit();
631: 
632:             return $affectedRows;
633:         } catch (PropelException $e) {
634:             $con->rollBack();
635:             throw $e;
636:         }
637:     }
638: 
639:     /**
640:      * Performs a DELETE on the database, given a Combination or Criteria object OR a primary key value.
641:      *
642:      * @param      mixed $values Criteria or Combination object or primary key or array of primary keys
643:      *              which is used to create the DELETE statement
644:      * @param      PropelPDO $con the connection to use
645:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
646:      *              if supported by native driver or if emulated using Propel.
647:      * @throws PropelException Any exceptions caught during processing will be
648:      *       rethrown wrapped into a PropelException.
649:      */
650:      public static function doDelete($values, PropelPDO $con = null)
651:      {
652:         if ($con === null) {
653:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
654:         }
655: 
656:         if ($values instanceof Criteria) {
657:             // invalidate the cache for all objects of this type, since we have no
658:             // way of knowing (without running a query) what objects should be invalidated
659:             // from the cache based on this Criteria.
660:             CombinationPeer::clearInstancePool();
661:             // rename for clarity
662:             $criteria = clone $values;
663:         } elseif ($values instanceof Combination) { // it's a model object
664:             // invalidate the cache for this single object
665:             CombinationPeer::removeInstanceFromPool($values);
666:             // create criteria based on pk values
667:             $criteria = $values->buildPkeyCriteria();
668:         } else { // it's a primary key, or an array of pks
669:             $criteria = new Criteria(CombinationPeer::DATABASE_NAME);
670:             $criteria->add(CombinationPeer::ID, (array) $values, Criteria::IN);
671:             // invalidate the cache for this object(s)
672:             foreach ((array) $values as $singleval) {
673:                 CombinationPeer::removeInstanceFromPool($singleval);
674:             }
675:         }
676: 
677:         // Set the correct dbName
678:         $criteria->setDbName(CombinationPeer::DATABASE_NAME);
679: 
680:         $affectedRows = 0; // initialize var to track total num of affected rows
681: 
682:         try {
683:             // use transaction because $criteria could contain info
684:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
685:             $con->beginTransaction();
686: 
687:             $affectedRows += BasePeer::doDelete($criteria, $con);
688:             CombinationPeer::clearRelatedInstancePool();
689:             $con->commit();
690: 
691:             return $affectedRows;
692:         } catch (PropelException $e) {
693:             $con->rollBack();
694:             throw $e;
695:         }
696:     }
697: 
698:     /**
699:      * Validates all modified columns of given Combination object.
700:      * If parameter $columns is either a single column name or an array of column names
701:      * than only those columns are validated.
702:      *
703:      * NOTICE: This does not apply to primary or foreign keys for now.
704:      *
705:      * @param      Combination $obj The object to validate.
706:      * @param      mixed $cols Column name or array of column names.
707:      *
708:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
709:      */
710:     public static function doValidate($obj, $cols = null)
711:     {
712:         $columns = array();
713: 
714:         if ($cols) {
715:             $dbMap = Propel::getDatabaseMap(CombinationPeer::DATABASE_NAME);
716:             $tableMap = $dbMap->getTable(CombinationPeer::TABLE_NAME);
717: 
718:             if (! is_array($cols)) {
719:                 $cols = array($cols);
720:             }
721: 
722:             foreach ($cols as $colName) {
723:                 if ($tableMap->hasColumn($colName)) {
724:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
725:                     $columns[$colName] = $obj->$get();
726:                 }
727:             }
728:         } else {
729: 
730:         }
731: 
732:         return BasePeer::doValidate(CombinationPeer::DATABASE_NAME, CombinationPeer::TABLE_NAME, $columns);
733:     }
734: 
735:     /**
736:      * Retrieve a single object by pkey.
737:      *
738:      * @param      int $pk the primary key.
739:      * @param      PropelPDO $con the connection to use
740:      * @return Combination
741:      */
742:     public static function retrieveByPK($pk, PropelPDO $con = null)
743:     {
744: 
745:         if (null !== ($obj = CombinationPeer::getInstanceFromPool((string) $pk))) {
746:             return $obj;
747:         }
748: 
749:         if ($con === null) {
750:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
751:         }
752: 
753:         $criteria = new Criteria(CombinationPeer::DATABASE_NAME);
754:         $criteria->add(CombinationPeer::ID, $pk);
755: 
756:         $v = CombinationPeer::doSelect($criteria, $con);
757: 
758:         return !empty($v) > 0 ? $v[0] : null;
759:     }
760: 
761:     /**
762:      * Retrieve multiple objects by pkey.
763:      *
764:      * @param      array $pks List of primary keys
765:      * @param      PropelPDO $con the connection to use
766:      * @return Combination[]
767:      * @throws PropelException Any exceptions caught during processing will be
768:      *       rethrown wrapped into a PropelException.
769:      */
770:     public static function retrieveByPKs($pks, PropelPDO $con = null)
771:     {
772:         if ($con === null) {
773:             $con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
774:         }
775: 
776:         $objs = null;
777:         if (empty($pks)) {
778:             $objs = array();
779:         } else {
780:             $criteria = new Criteria(CombinationPeer::DATABASE_NAME);
781:             $criteria->add(CombinationPeer::ID, $pks, Criteria::IN);
782:             $objs = CombinationPeer::doSelect($criteria, $con);
783:         }
784: 
785:         return $objs;
786:     }
787: 
788: } // BaseCombinationPeer
789: 
790: // This is the static code needed to register the TableMap for this table with the main Propel class.
791: //
792: BaseCombinationPeer::buildTableMap();
793: 
794: 
thelia API documentation generated by ApiGen 2.8.0