# File core/lib/Thelia/Model/om/BaseProductVersionPeer.php | thelia

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