       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\FeatureAvPeer;
      13: use Thelia\Model\FeaturePeer;
      14: use Thelia\Model\FeatureProd;
      15: use Thelia\Model\FeatureProdPeer;
      16: use Thelia\Model\ProductPeer;
      17: use Thelia\Model\map\FeatureProdTableMap;
      18:
      19: /**
      20:  * Base static class for performing query and update operations on the 'feature_prod' table.
      21:  *
      22:  *
      23:  *
      24:  * @package propel.generator.Thelia.Model.om
      25:  */
      26: abstract class BaseFeatureProdPeer
      27: {
      28:
      29:     /** the default database name for this class */
      30:     const DATABASE_NAME = 'thelia';
      31:
      32:     /** the table name for this class */
      33:     const TABLE_NAME = 'feature_prod';
      34:
      35:     /** the related Propel class for this table */
      36:     const OM_CLASS = 'Thelia\\Model\\FeatureProd';
      37:
      38:     /** the related TableMap class for this table */
      39:     const TM_CLASS = 'FeatureProdTableMap';
      40:
      41:     /** The total number of columns. */
      42:     const NUM_COLUMNS = 8;
      43:
      44:     /** The number of lazy-loaded columns. */
      45:     const NUM_LAZY_LOAD_COLUMNS = 0;
      46:
      47:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
      48:     const NUM_HYDRATE_COLUMNS = 8;
      49:
      50:     /** the column name for the id field */
      51:     const ID = 'feature_prod.id';
      52:
      53:     /** the column name for the product_id field */
      54:     const PRODUCT_ID = 'feature_prod.product_id';
      55:
      56:     /** the column name for the feature_id field */
      57:     const FEATURE_ID = 'feature_prod.feature_id';
      58:
      59:     /** the column name for the feature_av_id field */
      60:     const FEATURE_AV_ID = 'feature_prod.feature_av_id';
      61:
      62:     /** the column name for the by_default field */
      63:     const BY_DEFAULT = 'feature_prod.by_default';
      64:
      65:     /** the column name for the position field */
      66:     const POSITION = 'feature_prod.position';
      67:
      68:     /** the column name for the created_at field */
      69:     const CREATED_AT = 'feature_prod.created_at';
      70:
      71:     /** the column name for the updated_at field */
      72:     const UPDATED_AT = 'feature_prod.updated_at';
      73:
      74:     /** The default string format for model objects of the related table **/
      75:     const DEFAULT_STRING_FORMAT = 'YAML';
      76:
      77:     /**
      78:      * An identiy map to hold any loaded instances of FeatureProd objects.
      79:      * This must be public so that other peer classes can access this when hydrating from JOIN
      80:      * queries.
      81:      * @var        array FeatureProd[]
      82:      */
      83:     public static $instances = array();
      84:
      85:
      86:     /**
      87:      * holds an array of fieldnames
      88:      *
      89:      * first dimension keys are the type constants
      90:      * e.g. FeatureProdPeer::$fieldNames[FeatureProdPeer::TYPE_PHPNAME][0] = 'Id'
      91:      */
      92:     protected static $fieldNames = array (
      93:         BasePeer::TYPE_PHPNAME => array ('Id', 'ProductId', 'FeatureId', 'FeatureAvId', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ),
      94:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'productId', 'featureId', 'featureAvId', 'byDefault', 'position', 'createdAt', 'updatedAt', ),
      95:         BasePeer::TYPE_COLNAME => array (FeatureProdPeer::ID, FeatureProdPeer::PRODUCT_ID, FeatureProdPeer::FEATURE_ID, FeatureProdPeer::FEATURE_AV_ID, FeatureProdPeer::BY_DEFAULT, FeatureProdPeer::POSITION, FeatureProdPeer::CREATED_AT, FeatureProdPeer::UPDATED_AT, ),
      96:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PRODUCT_ID', 'FEATURE_ID', 'FEATURE_AV_ID', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
      97:         BasePeer::TYPE_FIELDNAME => array ('id', 'product_id', 'feature_id', 'feature_av_id', 'by_default', 'position', 'created_at', 'updated_at', ),
      98:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
      99:     );
     100:
     101:     /**
     102:      * holds an array of keys for quick access to the fieldnames array
     103:      *
     104:      * first dimension keys are the type constants
     105:      * e.g. FeatureProdPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
     106:      */
     107:     protected static $fieldKeys = array (
     108:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ProductId' => 1, 'FeatureId' => 2, 'FeatureAvId' => 3, 'ByDefault' => 4, 'Position' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
     109:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'productId' => 1, 'featureId' => 2, 'featureAvId' => 3, 'byDefault' => 4, 'position' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
     110:         BasePeer::TYPE_COLNAME => array (FeatureProdPeer::ID => 0, FeatureProdPeer::PRODUCT_ID => 1, FeatureProdPeer::FEATURE_ID => 2, FeatureProdPeer::FEATURE_AV_ID => 3, FeatureProdPeer::BY_DEFAULT => 4, FeatureProdPeer::POSITION => 5, FeatureProdPeer::CREATED_AT => 6, FeatureProdPeer::UPDATED_AT => 7, ),
     111:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PRODUCT_ID' => 1, 'FEATURE_ID' => 2, 'FEATURE_AV_ID' => 3, 'BY_DEFAULT' => 4, 'POSITION' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
     112:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'product_id' => 1, 'feature_id' => 2, 'feature_av_id' => 3, 'by_default' => 4, 'position' => 5, 'created_at' => 6, 'updated_at' => 7, ),
     113:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
     114:     );
     115:
     116:     /**
     117:      * Translates a fieldname to another type
     118:      *
     119:      * @param      string $name field name
     120:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     121:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     122:      * @param      string $toType   One of the class type constants
     123:      * @return string          translated name of the field.
     124:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
     125:      */
     126:     public static function translateFieldName($name, $fromType, $toType)
     127:     {
     128:         $toNames = FeatureProdPeer::getFieldNames($toType);
     129:         $key = isset(FeatureProdPeer::$fieldKeys[$fromType][$name]) ? FeatureProdPeer::$fieldKeys[$fromType][$name] : null;
     130:         if ($key === null) {
     131:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureProdPeer::$fieldKeys[$fromType], true));
     132:         }
     133:
     134:         return $toNames[$key];
     135:     }
     136:
     137:     /**
     138:      * Returns an array of field names.
     139:      *
     140:      * @param      string $type The type of fieldnames to return:
     141:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     142:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     143:      * @return array           A list of field names
     144:      * @throws PropelException - if the type is not valid.
     145:      */
     146:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
     147:     {
     148:         if (!array_key_exists($type, FeatureProdPeer::$fieldNames)) {
     149:             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.');
     150:         }
     151:
     152:         return FeatureProdPeer::$fieldNames[$type];
     153:     }
     154:
     155:     /**
     156:      * Convenience method which changes table.column to alias.column.
     157:      *
     158:      * Using this method you can maintain SQL abstraction while using column aliases.
     159:      * <code>
     160:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
     161:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
     162:      * </code>
     163:      * @param      string $alias The alias for the current table.
     164:      * @param      string $column The column name for current table. (i.e. FeatureProdPeer::COLUMN_NAME).
     165:      * @return string
     166:      */
     167:     public static function alias($alias, $column)
     168:     {
     169:         return str_replace(FeatureProdPeer::TABLE_NAME.'.', $alias.'.', $column);
     170:     }
     171:
     172:     /**
     173:      * Add all the columns needed to create a new object.
     174:      *
     175:      * Note: any columns that were marked with lazyLoad="true" in the
     176:      * XML schema will not be added to the select list and only loaded
     177:      * on demand.
     178:      *
     179:      * @param      Criteria $criteria object containing the columns to add.
     180:      * @param      string   $alias    optional table alias
     181:      * @throws PropelException Any exceptions caught during processing will be
     182:      *       rethrown wrapped into a PropelException.
     183:      */
     184:     public static function addSelectColumns(Criteria $criteria, $alias = null)
     185:     {
     186:         if (null === $alias) {
     187:             $criteria->addSelectColumn(FeatureProdPeer::ID);
     188:             $criteria->addSelectColumn(FeatureProdPeer::PRODUCT_ID);
     189:             $criteria->addSelectColumn(FeatureProdPeer::FEATURE_ID);
     190:             $criteria->addSelectColumn(FeatureProdPeer::FEATURE_AV_ID);
     191:             $criteria->addSelectColumn(FeatureProdPeer::BY_DEFAULT);
     192:             $criteria->addSelectColumn(FeatureProdPeer::POSITION);
     193:             $criteria->addSelectColumn(FeatureProdPeer::CREATED_AT);
     194:             $criteria->addSelectColumn(FeatureProdPeer::UPDATED_AT);
     195:         } else {
     196:             $criteria->addSelectColumn($alias . '.id');
     197:             $criteria->addSelectColumn($alias . '.product_id');
     198:             $criteria->addSelectColumn($alias . '.feature_id');
     199:             $criteria->addSelectColumn($alias . '.feature_av_id');
     200:             $criteria->addSelectColumn($alias . '.by_default');
     201:             $criteria->addSelectColumn($alias . '.position');
     202:             $criteria->addSelectColumn($alias . '.created_at');
     203:             $criteria->addSelectColumn($alias . '.updated_at');
     204:         }
     205:     }
     206:
     207:     /**
     208:      * Returns the number of rows matching criteria.
     209:      *
     210:      * @param      Criteria $criteria
     211:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     212:      * @param      PropelPDO $con
     213:      * @return int Number of matching rows.
     214:      */
     215:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
     216:     {
     217:         // we may modify criteria, so copy it first
     218:         $criteria = clone $criteria;
     219:
     220:         // We need to set the primary table name, since in the case that there are no WHERE columns
     221:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     222:         // tables go into the FROM clause.
     223:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     224:
     225:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     226:             $criteria->setDistinct();
     227:         }
     228:
     229:         if (!$criteria->hasSelectClause()) {
     230:             FeatureProdPeer::addSelectColumns($criteria);
     231:         }
     232:
     233:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     234:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME); // Set the correct dbName
     235:
     236:         if ($con === null) {
     237:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     238:         }
     239:         // BasePeer returns a PDOStatement
     240:         $stmt = BasePeer::doCount($criteria, $con);
     241:
     242:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     243:             $count = (int) $row[0];
     244:         } else {
     245:             $count = 0; // no rows returned; we infer that means 0 matches.
     246:         }
     247:         $stmt->closeCursor();
     248:
     249:         return $count;
     250:     }
     251:     /**
     252:      * Selects one object from the DB.
     253:      *
     254:      * @param      Criteria $criteria object used to create the SELECT statement.
     255:      * @param      PropelPDO $con
     256:      * @return                 FeatureProd
     257:      * @throws PropelException Any exceptions caught during processing will be
     258:      *       rethrown wrapped into a PropelException.
     259:      */
     260:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
     261:     {
     262:         $critcopy = clone $criteria;
     263:         $critcopy->setLimit(1);
     264:         $objects = FeatureProdPeer::doSelect($critcopy, $con);
     265:         if ($objects) {
     266:             return $objects[0];
     267:         }
     268:
     269:         return null;
     270:     }
     271:     /**
     272:      * Selects several row from the DB.
     273:      *
     274:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     275:      * @param      PropelPDO $con
     276:      * @return array           Array of selected Objects
     277:      * @throws PropelException Any exceptions caught during processing will be
     278:      *       rethrown wrapped into a PropelException.
     279:      */
     280:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
     281:     {
     282:         return FeatureProdPeer::populateObjects(FeatureProdPeer::doSelectStmt($criteria, $con));
     283:     }
     284:     /**
     285:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
     286:      *
     287:      * Use this method directly if you want to work with an executed statement directly (for example
     288:      * to perform your own object hydration).
     289:      *
     290:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     291:      * @param      PropelPDO $con The connection to use
     292:      * @throws PropelException Any exceptions caught during processing will be
     293:      *       rethrown wrapped into a PropelException.
     294:      * @return PDOStatement The executed PDOStatement object.
     295:      * @see        BasePeer::doSelect()
     296:      */
     297:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
     298:     {
     299:         if ($con === null) {
     300:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     301:         }
     302:
     303:         if (!$criteria->hasSelectClause()) {
     304:             $criteria = clone $criteria;
     305:             FeatureProdPeer::addSelectColumns($criteria);
     306:         }
     307:
     308:         // Set the correct dbName
     309:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     310:
     311:         // BasePeer returns a PDOStatement
     312:         return BasePeer::doSelect($criteria, $con);
     313:     }
     314:     /**
     315:      * Adds an object to the instance pool.
     316:      *
     317:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     318:      * from the database.  In some cases -- especially when you override doSelect*()
     319:      * methods in your stub classes -- you may need to explicitly add objects
     320:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
     321:      * and retrieveByPK*() calls.
     322:      *
     323:      * @param      FeatureProd $obj A FeatureProd object.
     324:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
     325:      */
     326:     public static function addInstanceToPool($obj, $key = null)
     327:     {
     328:         if (Propel::isInstancePoolingEnabled()) {
     329:             if ($key === null) {
     330:                 $key = (string) $obj->getId();
     331:             } // if key === null
     332:             FeatureProdPeer::$instances[$key] = $obj;
     333:         }
     334:     }
     335:
     336:     /**
     337:      * Removes an object from the instance pool.
     338:      *
     339:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     340:      * from the database.  In some cases -- especially when you override doDelete
     341:      * methods in your stub classes -- you may need to explicitly remove objects
     342:      * from the cache in order to prevent returning objects that no longer exist.
     343:      *
     344:      * @param      mixed $value A FeatureProd object or a primary key value.
     345:      *
     346:      * @return void
     347:      * @throws PropelException - if the value is invalid.
     348:      */
     349:     public static function removeInstanceFromPool($value)
     350:     {
     351:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
     352:             if (is_object($value) && $value instanceof FeatureProd) {
     353:                 $key = (string) $value->getId();
     354:             } elseif (is_scalar($value)) {
     355:                 // assume we've been passed a primary key
     356:                 $key = (string) $value;
     357:             } else {
     358:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or FeatureProd object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
     359:                 throw $e;
     360:             }
     361:
     362:             unset(FeatureProdPeer::$instances[$key]);
     363:         }
     364:     } // removeInstanceFromPool()
     365:
     366:     /**
     367:      * 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.
     368:      *
     369:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     370:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     371:      *
     372:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
     373:      * @return   FeatureProd Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
     374:      * @see        getPrimaryKeyHash()
     375:      */
     376:     public static function getInstanceFromPool($key)
     377:     {
     378:         if (Propel::isInstancePoolingEnabled()) {
     379:             if (isset(FeatureProdPeer::$instances[$key])) {
     380:                 return FeatureProdPeer::$instances[$key];
     381:             }
     382:         }
     383:
     384:         return null; // just to be explicit
     385:     }
     386:
     387:     /**
     388:      * Clear the instance pool.
     389:      *
     390:      * @return void
     391:      */
     392:     public static function clearInstancePool($and_clear_all_references = false)
     393:     {
     394:       if ($and_clear_all_references)
     395:       {
     396:         foreach (FeatureProdPeer::$instances as $instance)
     397:         {
     398:           $instance->clearAllReferences(true);
     399:         }
     400:       }
     401:         FeatureProdPeer::$instances = array();
     402:     }
     403:
     404:     /**
     405:      * Method to invalidate the instance pool of all tables related to feature_prod
     406:      * by a foreign key with ON DELETE CASCADE
     407:      */
     408:     public static function clearRelatedInstancePool()
     409:     {
     410:     }
     411:
     412:     /**
     413:      * 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.
     414:      *
     415:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     416:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     417:      *
     418:      * @param      array $row PropelPDO resultset row.
     419:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     420:      * @return string A string version of PK or null if the components of primary key in result array are all null.
     421:      */
     422:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
     423:     {
     424:         // If the PK cannot be derived from the row, return null.
     425:         if ($row[$startcol] === null) {
     426:             return null;
     427:         }
     428:
     429:         return (string) $row[$startcol];
     430:     }
     431:
     432:     /**
     433:      * Retrieves the primary key from the DB resultset row
     434:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     435:      * a multi-column primary key, an array of the primary key columns will be returned.
     436:      *
     437:      * @param      array $row PropelPDO resultset row.
     438:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     439:      * @return mixed The primary key of the row
     440:      */
     441:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
     442:     {
     443:
     444:         return (int) $row[$startcol];
     445:     }
     446:
     447:     /**
     448:      * The returned array will contain objects of the default type or
     449:      * objects that inherit from the default.
     450:      *
     451:      * @throws PropelException Any exceptions caught during processing will be
     452:      *       rethrown wrapped into a PropelException.
     453:      */
     454:     public static function populateObjects(PDOStatement $stmt)
     455:     {
     456:         $results = array();
     457:
     458:         // set the class once to avoid overhead in the loop
     459:         $cls = FeatureProdPeer::getOMClass();
     460:         // populate the object(s)
     461:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     462:             $key = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     463:             if (null !== ($obj = FeatureProdPeer::getInstanceFromPool($key))) {
     464:                 // We no longer rehydrate the object, since this can cause data loss.
     465:                 // See http://www.propelorm.org/ticket/509
     466:                 // $obj->hydrate($row, 0, true); // rehydrate
     467:                 $results[] = $obj;
     468:             } else {
     469:                 $obj = new $cls();
     470:                 $obj->hydrate($row);
     471:                 $results[] = $obj;
     472:                 FeatureProdPeer::addInstanceToPool($obj, $key);
     473:             } // if key exists
     474:         }
     475:         $stmt->closeCursor();
     476:
     477:         return $results;
     478:     }
     479:     /**
     480:      * Populates an object of the default type or an object that inherit from the default.
     481:      *
     482:      * @param      array $row PropelPDO resultset row.
     483:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     484:      * @throws PropelException Any exceptions caught during processing will be
     485:      *       rethrown wrapped into a PropelException.
     486:      * @return array (FeatureProd object, last column rank)
     487:      */
     488:     public static function populateObject($row, $startcol = 0)
     489:     {
     490:         $key = FeatureProdPeer::getPrimaryKeyHashFromRow($row, $startcol);
     491:         if (null !== ($obj = FeatureProdPeer::getInstanceFromPool($key))) {
     492:             // We no longer rehydrate the object, since this can cause data loss.
     493:             // See http://www.propelorm.org/ticket/509
     494:             // $obj->hydrate($row, $startcol, true); // rehydrate
     495:             $col = $startcol + FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     496:         } else {
     497:             $cls = FeatureProdPeer::OM_CLASS;
     498:             $obj = new $cls();
     499:             $col = $obj->hydrate($row, $startcol);
     500:             FeatureProdPeer::addInstanceToPool($obj, $key);
     501:         }
     502:
     503:         return array($obj, $col);
     504:     }
     505:
     506:
     507:     /**
     508:      * Returns the number of rows matching criteria, joining the related Product table
     509:      *
     510:      * @param      Criteria $criteria
     511:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     512:      * @param      PropelPDO $con
     513:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     514:      * @return int Number of matching rows.
     515:      */
     516:     public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     517:     {
     518:         // we're going to modify criteria, so copy it first
     519:         $criteria = clone $criteria;
     520:
     521:         // We need to set the primary table name, since in the case that there are no WHERE columns
     522:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     523:         // tables go into the FROM clause.
     524:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     525:
     526:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     527:             $criteria->setDistinct();
     528:         }
     529:
     530:         if (!$criteria->hasSelectClause()) {
     531:             FeatureProdPeer::addSelectColumns($criteria);
     532:         }
     533:
     534:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     535:
     536:         // Set the correct dbName
     537:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     538:
     539:         if ($con === null) {
     540:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     541:         }
     542:
     543:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     544:
     545:         $stmt = BasePeer::doCount($criteria, $con);
     546:
     547:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     548:             $count = (int) $row[0];
     549:         } else {
     550:             $count = 0; // no rows returned; we infer that means 0 matches.
     551:         }
     552:         $stmt->closeCursor();
     553:
     554:         return $count;
     555:     }
     556:
     557:
     558:     /**
     559:      * Returns the number of rows matching criteria, joining the related Feature table
     560:      *
     561:      * @param      Criteria $criteria
     562:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     563:      * @param      PropelPDO $con
     564:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     565:      * @return int Number of matching rows.
     566:      */
     567:     public static function doCountJoinFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     568:     {
     569:         // we're going to modify criteria, so copy it first
     570:         $criteria = clone $criteria;
     571:
     572:         // We need to set the primary table name, since in the case that there are no WHERE columns
     573:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     574:         // tables go into the FROM clause.
     575:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     576:
     577:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     578:             $criteria->setDistinct();
     579:         }
     580:
     581:         if (!$criteria->hasSelectClause()) {
     582:             FeatureProdPeer::addSelectColumns($criteria);
     583:         }
     584:
     585:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     586:
     587:         // Set the correct dbName
     588:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     589:
     590:         if ($con === null) {
     591:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     592:         }
     593:
     594:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     595:
     596:         $stmt = BasePeer::doCount($criteria, $con);
     597:
     598:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     599:             $count = (int) $row[0];
     600:         } else {
     601:             $count = 0; // no rows returned; we infer that means 0 matches.
     602:         }
     603:         $stmt->closeCursor();
     604:
     605:         return $count;
     606:     }
     607:
     608:
     609:     /**
     610:      * Returns the number of rows matching criteria, joining the related FeatureAv table
     611:      *
     612:      * @param      Criteria $criteria
     613:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     614:      * @param      PropelPDO $con
     615:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     616:      * @return int Number of matching rows.
     617:      */
     618:     public static function doCountJoinFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     619:     {
     620:         // we're going to modify criteria, so copy it first
     621:         $criteria = clone $criteria;
     622:
     623:         // We need to set the primary table name, since in the case that there are no WHERE columns
     624:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     625:         // tables go into the FROM clause.
     626:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     627:
     628:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     629:             $criteria->setDistinct();
     630:         }
     631:
     632:         if (!$criteria->hasSelectClause()) {
     633:             FeatureProdPeer::addSelectColumns($criteria);
     634:         }
     635:
     636:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     637:
     638:         // Set the correct dbName
     639:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     640:
     641:         if ($con === null) {
     642:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     643:         }
     644:
     645:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     646:
     647:         $stmt = BasePeer::doCount($criteria, $con);
     648:
     649:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     650:             $count = (int) $row[0];
     651:         } else {
     652:             $count = 0; // no rows returned; we infer that means 0 matches.
     653:         }
     654:         $stmt->closeCursor();
     655:
     656:         return $count;
     657:     }
     658:
     659:
     660:     /**
     661:      * Selects a collection of FeatureProd objects pre-filled with their Product objects.
     662:      * @param      Criteria  $criteria
     663:      * @param      PropelPDO $con
     664:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     665:      * @return array           Array of FeatureProd objects.
     666:      * @throws PropelException Any exceptions caught during processing will be
     667:      *       rethrown wrapped into a PropelException.
     668:      */
     669:     public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     670:     {
     671:         $criteria = clone $criteria;
     672:
     673:         // Set the correct dbName if it has not been overridden
     674:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     675:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     676:         }
     677:
     678:         FeatureProdPeer::addSelectColumns($criteria);
     679:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     680:         ProductPeer::addSelectColumns($criteria);
     681:
     682:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     683:
     684:         $stmt = BasePeer::doSelect($criteria, $con);
     685:         $results = array();
     686:
     687:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     688:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     689:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     690:                 // We no longer rehydrate the object, since this can cause data loss.
     691:                 // See http://www.propelorm.org/ticket/509
     692:                 // $obj1->hydrate($row, 0, true); // rehydrate
     693:             } else {
     694:
     695:                 $cls = FeatureProdPeer::getOMClass();
     696:
     697:                 $obj1 = new $cls();
     698:                 $obj1->hydrate($row);
     699:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     700:             } // if $obj1 already loaded
     701:
     702:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
     703:             if ($key2 !== null) {
     704:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
     705:                 if (!$obj2) {
     706:
     707:                     $cls = ProductPeer::getOMClass();
     708:
     709:                     $obj2 = new $cls();
     710:                     $obj2->hydrate($row, $startcol);
     711:                     ProductPeer::addInstanceToPool($obj2, $key2);
     712:                 } // if obj2 already loaded
     713:
     714:                 // Add the $obj1 (FeatureProd) to $obj2 (Product)
     715:                 $obj2->addFeatureProd($obj1);
     716:
     717:             } // if joined row was not null
     718:
     719:             $results[] = $obj1;
     720:         }
     721:         $stmt->closeCursor();
     722:
     723:         return $results;
     724:     }
     725:
     726:
     727:     /**
     728:      * Selects a collection of FeatureProd objects pre-filled with their Feature objects.
     729:      * @param      Criteria  $criteria
     730:      * @param      PropelPDO $con
     731:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     732:      * @return array           Array of FeatureProd objects.
     733:      * @throws PropelException Any exceptions caught during processing will be
     734:      *       rethrown wrapped into a PropelException.
     735:      */
     736:     public static function doSelectJoinFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     737:     {
     738:         $criteria = clone $criteria;
     739:
     740:         // Set the correct dbName if it has not been overridden
     741:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     742:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     743:         }
     744:
     745:         FeatureProdPeer::addSelectColumns($criteria);
     746:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     747:         FeaturePeer::addSelectColumns($criteria);
     748:
     749:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     750:
     751:         $stmt = BasePeer::doSelect($criteria, $con);
     752:         $results = array();
     753:
     754:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     755:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     756:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     757:                 // We no longer rehydrate the object, since this can cause data loss.
     758:                 // See http://www.propelorm.org/ticket/509
     759:                 // $obj1->hydrate($row, 0, true); // rehydrate
     760:             } else {
     761:
     762:                 $cls = FeatureProdPeer::getOMClass();
     763:
     764:                 $obj1 = new $cls();
     765:                 $obj1->hydrate($row);
     766:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     767:             } // if $obj1 already loaded
     768:
     769:             $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol);
     770:             if ($key2 !== null) {
     771:                 $obj2 = FeaturePeer::getInstanceFromPool($key2);
     772:                 if (!$obj2) {
     773:
     774:                     $cls = FeaturePeer::getOMClass();
     775:
     776:                     $obj2 = new $cls();
     777:                     $obj2->hydrate($row, $startcol);
     778:                     FeaturePeer::addInstanceToPool($obj2, $key2);
     779:                 } // if obj2 already loaded
     780:
     781:                 // Add the $obj1 (FeatureProd) to $obj2 (Feature)
     782:                 $obj2->addFeatureProd($obj1);
     783:
     784:             } // if joined row was not null
     785:
     786:             $results[] = $obj1;
     787:         }
     788:         $stmt->closeCursor();
     789:
     790:         return $results;
     791:     }
     792:
     793:
     794:     /**
     795:      * Selects a collection of FeatureProd objects pre-filled with their FeatureAv objects.
     796:      * @param      Criteria  $criteria
     797:      * @param      PropelPDO $con
     798:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     799:      * @return array           Array of FeatureProd objects.
     800:      * @throws PropelException Any exceptions caught during processing will be
     801:      *       rethrown wrapped into a PropelException.
     802:      */
     803:     public static function doSelectJoinFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     804:     {
     805:         $criteria = clone $criteria;
     806:
     807:         // Set the correct dbName if it has not been overridden
     808:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     809:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     810:         }
     811:
     812:         FeatureProdPeer::addSelectColumns($criteria);
     813:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     814:         FeatureAvPeer::addSelectColumns($criteria);
     815:
     816:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     817:
     818:         $stmt = BasePeer::doSelect($criteria, $con);
     819:         $results = array();
     820:
     821:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     822:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     823:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     824:                 // We no longer rehydrate the object, since this can cause data loss.
     825:                 // See http://www.propelorm.org/ticket/509
     826:                 // $obj1->hydrate($row, 0, true); // rehydrate
     827:             } else {
     828:
     829:                 $cls = FeatureProdPeer::getOMClass();
     830:
     831:                 $obj1 = new $cls();
     832:                 $obj1->hydrate($row);
     833:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     834:             } // if $obj1 already loaded
     835:
     836:             $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
     837:             if ($key2 !== null) {
     838:                 $obj2 = FeatureAvPeer::getInstanceFromPool($key2);
     839:                 if (!$obj2) {
     840:
     841:                     $cls = FeatureAvPeer::getOMClass();
     842:
     843:                     $obj2 = new $cls();
     844:                     $obj2->hydrate($row, $startcol);
     845:                     FeatureAvPeer::addInstanceToPool($obj2, $key2);
     846:                 } // if obj2 already loaded
     847:
     848:                 // Add the $obj1 (FeatureProd) to $obj2 (FeatureAv)
     849:                 $obj2->addFeatureProd($obj1);
     850:
     851:             } // if joined row was not null
     852:
     853:             $results[] = $obj1;
     854:         }
     855:         $stmt->closeCursor();
     856:
     857:         return $results;
     858:     }
     859:
     860:
     861:     /**
     862:      * Returns the number of rows matching criteria, joining all related tables
     863:      *
     864:      * @param      Criteria $criteria
     865:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     866:      * @param      PropelPDO $con
     867:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     868:      * @return int Number of matching rows.
     869:      */
     870:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     871:     {
     872:         // we're going to modify criteria, so copy it first
     873:         $criteria = clone $criteria;
     874:
     875:         // We need to set the primary table name, since in the case that there are no WHERE columns
     876:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     877:         // tables go into the FROM clause.
     878:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     879:
     880:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     881:             $criteria->setDistinct();
     882:         }
     883:
     884:         if (!$criteria->hasSelectClause()) {
     885:             FeatureProdPeer::addSelectColumns($criteria);
     886:         }
     887:
     888:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     889:
     890:         // Set the correct dbName
     891:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     892:
     893:         if ($con === null) {
     894:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     895:         }
     896:
     897:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     898:
     899:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     900:
     901:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     902:
     903:         $stmt = BasePeer::doCount($criteria, $con);
     904:
     905:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     906:             $count = (int) $row[0];
     907:         } else {
     908:             $count = 0; // no rows returned; we infer that means 0 matches.
     909:         }
     910:         $stmt->closeCursor();
     911:
     912:         return $count;
     913:     }
     914:
     915:     /**
     916:      * Selects a collection of FeatureProd objects pre-filled with all related objects.
     917:      *
     918:      * @param      Criteria  $criteria
     919:      * @param      PropelPDO $con
     920:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     921:      * @return array           Array of FeatureProd objects.
     922:      * @throws PropelException Any exceptions caught during processing will be
     923:      *       rethrown wrapped into a PropelException.
     924:      */
     925:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     926:     {
     927:         $criteria = clone $criteria;
     928:
     929:         // Set the correct dbName if it has not been overridden
     930:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     931:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     932:         }
     933:
     934:         FeatureProdPeer::addSelectColumns($criteria);
     935:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     936:
     937:         ProductPeer::addSelectColumns($criteria);
     938:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
     939:
     940:         FeaturePeer::addSelectColumns($criteria);
     941:         $startcol4 = $startcol3 + FeaturePeer::NUM_HYDRATE_COLUMNS;
     942:
     943:         FeatureAvPeer::addSelectColumns($criteria);
     944:         $startcol5 = $startcol4 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
     945:
     946:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     947:
     948:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     949:
     950:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     951:
     952:         $stmt = BasePeer::doSelect($criteria, $con);
     953:         $results = array();
     954:
     955:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     956:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     957:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     958:                 // We no longer rehydrate the object, since this can cause data loss.
     959:                 // See http://www.propelorm.org/ticket/509
     960:                 // $obj1->hydrate($row, 0, true); // rehydrate
     961:             } else {
     962:                 $cls = FeatureProdPeer::getOMClass();
     963:
     964:                 $obj1 = new $cls();
     965:                 $obj1->hydrate($row);
     966:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     967:             } // if obj1 already loaded
     968:
     969:             // Add objects for joined Product rows
     970:
     971:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
     972:             if ($key2 !== null) {
     973:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
     974:                 if (!$obj2) {
     975:
     976:                     $cls = ProductPeer::getOMClass();
     977:
     978:                     $obj2 = new $cls();
     979:                     $obj2->hydrate($row, $startcol2);
     980:                     ProductPeer::addInstanceToPool($obj2, $key2);
     981:                 } // if obj2 loaded
     982:
     983:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
     984:                 $obj2->addFeatureProd($obj1);
     985:             } // if joined row not null
     986:
     987:             // Add objects for joined Feature rows
     988:
     989:             $key3 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol3);
     990:             if ($key3 !== null) {
     991:                 $obj3 = FeaturePeer::getInstanceFromPool($key3);
     992:                 if (!$obj3) {
     993:
     994:                     $cls = FeaturePeer::getOMClass();
     995:
     996:                     $obj3 = new $cls();
     997:                     $obj3->hydrate($row, $startcol3);
     998:                     FeaturePeer::addInstanceToPool($obj3, $key3);
     999:                 } // if obj3 loaded
    1000:
    1001:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (Feature)
    1002:                 $obj3->addFeatureProd($obj1);
    1003:             } // if joined row not null
    1004:
    1005:             // Add objects for joined FeatureAv rows
    1006:
    1007:             $key4 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol4);
    1008:             if ($key4 !== null) {
    1009:                 $obj4 = FeatureAvPeer::getInstanceFromPool($key4);
    1010:                 if (!$obj4) {
    1011:
    1012:                     $cls = FeatureAvPeer::getOMClass();
    1013:
    1014:                     $obj4 = new $cls();
    1015:                     $obj4->hydrate($row, $startcol4);
    1016:                     FeatureAvPeer::addInstanceToPool($obj4, $key4);
    1017:                 } // if obj4 loaded
    1018:
    1019:                 // Add the $obj1 (FeatureProd) to the collection in $obj4 (FeatureAv)
    1020:                 $obj4->addFeatureProd($obj1);
    1021:             } // if joined row not null
    1022:
    1023:             $results[] = $obj1;
    1024:         }
    1025:         $stmt->closeCursor();
    1026:
    1027:         return $results;
    1028:     }
    1029:
    1030:
    1031:     /**
    1032:      * Returns the number of rows matching criteria, joining the related Product table
    1033:      *
    1034:      * @param      Criteria $criteria
    1035:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1036:      * @param      PropelPDO $con
    1037:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1038:      * @return int Number of matching rows.
    1039:      */
    1040:     public static function doCountJoinAllExceptProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1041:     {
    1042:         // we're going to modify criteria, so copy it first
    1043:         $criteria = clone $criteria;
    1044:
    1045:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1046:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1047:         // tables go into the FROM clause.
    1048:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1049:
    1050:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1051:             $criteria->setDistinct();
    1052:         }
    1053:
    1054:         if (!$criteria->hasSelectClause()) {
    1055:             FeatureProdPeer::addSelectColumns($criteria);
    1056:         }
    1057:
    1058:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1059:
    1060:         // Set the correct dbName
    1061:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1062:
    1063:         if ($con === null) {
    1064:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1065:         }
    1066:
    1067:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1068:
    1069:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1070:
    1071:         $stmt = BasePeer::doCount($criteria, $con);
    1072:
    1073:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1074:             $count = (int) $row[0];
    1075:         } else {
    1076:             $count = 0; // no rows returned; we infer that means 0 matches.
    1077:         }
    1078:         $stmt->closeCursor();
    1079:
    1080:         return $count;
    1081:     }
    1082:
    1083:
    1084:     /**
    1085:      * Returns the number of rows matching criteria, joining the related Feature table
    1086:      *
    1087:      * @param      Criteria $criteria
    1088:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1089:      * @param      PropelPDO $con
    1090:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1091:      * @return int Number of matching rows.
    1092:      */
    1093:     public static function doCountJoinAllExceptFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1094:     {
    1095:         // we're going to modify criteria, so copy it first
    1096:         $criteria = clone $criteria;
    1097:
    1098:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1099:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1100:         // tables go into the FROM clause.
    1101:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1102:
    1103:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1104:             $criteria->setDistinct();
    1105:         }
    1106:
    1107:         if (!$criteria->hasSelectClause()) {
    1108:             FeatureProdPeer::addSelectColumns($criteria);
    1109:         }
    1110:
    1111:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1112:
    1113:         // Set the correct dbName
    1114:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1115:
    1116:         if ($con === null) {
    1117:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1118:         }
    1119:
    1120:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1121:
    1122:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1123:
    1124:         $stmt = BasePeer::doCount($criteria, $con);
    1125:
    1126:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1127:             $count = (int) $row[0];
    1128:         } else {
    1129:             $count = 0; // no rows returned; we infer that means 0 matches.
    1130:         }
    1131:         $stmt->closeCursor();
    1132:
    1133:         return $count;
    1134:     }
    1135:
    1136:
    1137:     /**
    1138:      * Returns the number of rows matching criteria, joining the related FeatureAv table
    1139:      *
    1140:      * @param      Criteria $criteria
    1141:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1142:      * @param      PropelPDO $con
    1143:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1144:      * @return int Number of matching rows.
    1145:      */
    1146:     public static function doCountJoinAllExceptFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1147:     {
    1148:         // we're going to modify criteria, so copy it first
    1149:         $criteria = clone $criteria;
    1150:
    1151:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1152:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1153:         // tables go into the FROM clause.
    1154:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1155:
    1156:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1157:             $criteria->setDistinct();
    1158:         }
    1159:
    1160:         if (!$criteria->hasSelectClause()) {
    1161:             FeatureProdPeer::addSelectColumns($criteria);
    1162:         }
    1163:
    1164:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1165:
    1166:         // Set the correct dbName
    1167:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1168:
    1169:         if ($con === null) {
    1170:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1171:         }
    1172:
    1173:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1174:
    1175:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1176:
    1177:         $stmt = BasePeer::doCount($criteria, $con);
    1178:
    1179:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1180:             $count = (int) $row[0];
    1181:         } else {
    1182:             $count = 0; // no rows returned; we infer that means 0 matches.
    1183:         }
    1184:         $stmt->closeCursor();
    1185:
    1186:         return $count;
    1187:     }
    1188:
    1189:
    1190:     /**
    1191:      * Selects a collection of FeatureProd objects pre-filled with all related objects except Product.
    1192:      *
    1193:      * @param      Criteria  $criteria
    1194:      * @param      PropelPDO $con
    1195:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1196:      * @return array           Array of FeatureProd objects.
    1197:      * @throws PropelException Any exceptions caught during processing will be
    1198:      *       rethrown wrapped into a PropelException.
    1199:      */
    1200:     public static function doSelectJoinAllExceptProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1201:     {
    1202:         $criteria = clone $criteria;
    1203:
    1204:         // Set the correct dbName if it has not been overridden
    1205:         // $criteria->getDbName() will return the same object if not set to another value
    1206:         // so == check is okay and faster
    1207:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1208:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1209:         }
    1210:
    1211:         FeatureProdPeer::addSelectColumns($criteria);
    1212:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1213:
    1214:         FeaturePeer::addSelectColumns($criteria);
    1215:         $startcol3 = $startcol2 + FeaturePeer::NUM_HYDRATE_COLUMNS;
    1216:
    1217:         FeatureAvPeer::addSelectColumns($criteria);
    1218:         $startcol4 = $startcol3 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
    1219:
    1220:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1221:
    1222:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1223:
    1224:
    1225:         $stmt = BasePeer::doSelect($criteria, $con);
    1226:         $results = array();
    1227:
    1228:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1229:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1230:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1231:                 // We no longer rehydrate the object, since this can cause data loss.
    1232:                 // See http://www.propelorm.org/ticket/509
    1233:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1234:             } else {
    1235:                 $cls = FeatureProdPeer::getOMClass();
    1236:
    1237:                 $obj1 = new $cls();
    1238:                 $obj1->hydrate($row);
    1239:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1240:             } // if obj1 already loaded
    1241:
    1242:                 // Add objects for joined Feature rows
    1243:
    1244:                 $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1245:                 if ($key2 !== null) {
    1246:                     $obj2 = FeaturePeer::getInstanceFromPool($key2);
    1247:                     if (!$obj2) {
    1248:
    1249:                         $cls = FeaturePeer::getOMClass();
    1250:
    1251:                     $obj2 = new $cls();
    1252:                     $obj2->hydrate($row, $startcol2);
    1253:                     FeaturePeer::addInstanceToPool($obj2, $key2);
    1254:                 } // if $obj2 already loaded
    1255:
    1256:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Feature)
    1257:                 $obj2->addFeatureProd($obj1);
    1258:
    1259:             } // if joined row is not null
    1260:
    1261:                 // Add objects for joined FeatureAv rows
    1262:
    1263:                 $key3 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1264:                 if ($key3 !== null) {
    1265:                     $obj3 = FeatureAvPeer::getInstanceFromPool($key3);
    1266:                     if (!$obj3) {
    1267:
    1268:                         $cls = FeatureAvPeer::getOMClass();
    1269:
    1270:                     $obj3 = new $cls();
    1271:                     $obj3->hydrate($row, $startcol3);
    1272:                     FeatureAvPeer::addInstanceToPool($obj3, $key3);
    1273:                 } // if $obj3 already loaded
    1274:
    1275:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (FeatureAv)
    1276:                 $obj3->addFeatureProd($obj1);
    1277:
    1278:             } // if joined row is not null
    1279:
    1280:             $results[] = $obj1;
    1281:         }
    1282:         $stmt->closeCursor();
    1283:
    1284:         return $results;
    1285:     }
    1286:
    1287:
    1288:     /**
    1289:      * Selects a collection of FeatureProd objects pre-filled with all related objects except Feature.
    1290:      *
    1291:      * @param      Criteria  $criteria
    1292:      * @param      PropelPDO $con
    1293:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1294:      * @return array           Array of FeatureProd objects.
    1295:      * @throws PropelException Any exceptions caught during processing will be
    1296:      *       rethrown wrapped into a PropelException.
    1297:      */
    1298:     public static function doSelectJoinAllExceptFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1299:     {
    1300:         $criteria = clone $criteria;
    1301:
    1302:         // Set the correct dbName if it has not been overridden
    1303:         // $criteria->getDbName() will return the same object if not set to another value
    1304:         // so == check is okay and faster
    1305:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1306:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1307:         }
    1308:
    1309:         FeatureProdPeer::addSelectColumns($criteria);
    1310:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1311:
    1312:         ProductPeer::addSelectColumns($criteria);
    1313:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
    1314:
    1315:         FeatureAvPeer::addSelectColumns($criteria);
    1316:         $startcol4 = $startcol3 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
    1317:
    1318:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1319:
    1320:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1321:
    1322:
    1323:         $stmt = BasePeer::doSelect($criteria, $con);
    1324:         $results = array();
    1325:
    1326:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1327:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1328:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1329:                 // We no longer rehydrate the object, since this can cause data loss.
    1330:                 // See http://www.propelorm.org/ticket/509
    1331:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1332:             } else {
    1333:                 $cls = FeatureProdPeer::getOMClass();
    1334:
    1335:                 $obj1 = new $cls();
    1336:                 $obj1->hydrate($row);
    1337:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1338:             } // if obj1 already loaded
    1339:
    1340:                 // Add objects for joined Product rows
    1341:
    1342:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1343:                 if ($key2 !== null) {
    1344:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
    1345:                     if (!$obj2) {
    1346:
    1347:                         $cls = ProductPeer::getOMClass();
    1348:
    1349:                     $obj2 = new $cls();
    1350:                     $obj2->hydrate($row, $startcol2);
    1351:                     ProductPeer::addInstanceToPool($obj2, $key2);
    1352:                 } // if $obj2 already loaded
    1353:
    1354:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
    1355:                 $obj2->addFeatureProd($obj1);
    1356:
    1357:             } // if joined row is not null
    1358:
    1359:                 // Add objects for joined FeatureAv rows
    1360:
    1361:                 $key3 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1362:                 if ($key3 !== null) {
    1363:                     $obj3 = FeatureAvPeer::getInstanceFromPool($key3);
    1364:                     if (!$obj3) {
    1365:
    1366:                         $cls = FeatureAvPeer::getOMClass();
    1367:
    1368:                     $obj3 = new $cls();
    1369:                     $obj3->hydrate($row, $startcol3);
    1370:                     FeatureAvPeer::addInstanceToPool($obj3, $key3);
    1371:                 } // if $obj3 already loaded
    1372:
    1373:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (FeatureAv)
    1374:                 $obj3->addFeatureProd($obj1);
    1375:
    1376:             } // if joined row is not null
    1377:
    1378:             $results[] = $obj1;
    1379:         }
    1380:         $stmt->closeCursor();
    1381:
    1382:         return $results;
    1383:     }
    1384:
    1385:
    1386:     /**
    1387:      * Selects a collection of FeatureProd objects pre-filled with all related objects except FeatureAv.
    1388:      *
    1389:      * @param      Criteria  $criteria
    1390:      * @param      PropelPDO $con
    1391:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1392:      * @return array           Array of FeatureProd objects.
    1393:      * @throws PropelException Any exceptions caught during processing will be
    1394:      *       rethrown wrapped into a PropelException.
    1395:      */
    1396:     public static function doSelectJoinAllExceptFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1397:     {
    1398:         $criteria = clone $criteria;
    1399:
    1400:         // Set the correct dbName if it has not been overridden
    1401:         // $criteria->getDbName() will return the same object if not set to another value
    1402:         // so == check is okay and faster
    1403:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1404:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1405:         }
    1406:
    1407:         FeatureProdPeer::addSelectColumns($criteria);
    1408:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1409:
    1410:         ProductPeer::addSelectColumns($criteria);
    1411:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
    1412:
    1413:         FeaturePeer::addSelectColumns($criteria);
    1414:         $startcol4 = $startcol3 + FeaturePeer::NUM_HYDRATE_COLUMNS;
    1415:
    1416:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1417:
    1418:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1419:
    1420:
    1421:         $stmt = BasePeer::doSelect($criteria, $con);
    1422:         $results = array();
    1423:
    1424:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1425:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1426:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1427:                 // We no longer rehydrate the object, since this can cause data loss.
    1428:                 // See http://www.propelorm.org/ticket/509
    1429:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1430:             } else {
    1431:                 $cls = FeatureProdPeer::getOMClass();
    1432:
    1433:                 $obj1 = new $cls();
    1434:                 $obj1->hydrate($row);
    1435:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1436:             } // if obj1 already loaded
    1437:
    1438:                 // Add objects for joined Product rows
    1439:
    1440:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1441:                 if ($key2 !== null) {
    1442:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
    1443:                     if (!$obj2) {
    1444:
    1445:                         $cls = ProductPeer::getOMClass();
    1446:
    1447:                     $obj2 = new $cls();
    1448:                     $obj2->hydrate($row, $startcol2);
    1449:                     ProductPeer::addInstanceToPool($obj2, $key2);
    1450:                 } // if $obj2 already loaded
    1451:
    1452:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
    1453:                 $obj2->addFeatureProd($obj1);
    1454:
    1455:             } // if joined row is not null
    1456:
    1457:                 // Add objects for joined Feature rows
    1458:
    1459:                 $key3 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1460:                 if ($key3 !== null) {
    1461:                     $obj3 = FeaturePeer::getInstanceFromPool($key3);
    1462:                     if (!$obj3) {
    1463:
    1464:                         $cls = FeaturePeer::getOMClass();
    1465:
    1466:                     $obj3 = new $cls();
    1467:                     $obj3->hydrate($row, $startcol3);
    1468:                     FeaturePeer::addInstanceToPool($obj3, $key3);
    1469:                 } // if $obj3 already loaded
    1470:
    1471:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (Feature)
    1472:                 $obj3->addFeatureProd($obj1);
    1473:
    1474:             } // if joined row is not null
    1475:
    1476:             $results[] = $obj1;
    1477:         }
    1478:         $stmt->closeCursor();
    1479:
    1480:         return $results;
    1481:     }
    1482:
    1483:     /**
    1484:      * Returns the TableMap related to this peer.
    1485:      * This method is not needed for general use but a specific application could have a need.
    1486:      * @return TableMap
    1487:      * @throws PropelException Any exceptions caught during processing will be
    1488:      *       rethrown wrapped into a PropelException.
    1489:      */
    1490:     public static function getTableMap()
    1491:     {
    1492:         return Propel::getDatabaseMap(FeatureProdPeer::DATABASE_NAME)->getTable(FeatureProdPeer::TABLE_NAME);
    1493:     }
    1494:
    1495:     /**
    1496:      * Add a TableMap instance to the database for this peer class.
    1497:      */
    1498:     public static function buildTableMap()
    1499:     {
    1500:       $dbMap = Propel::getDatabaseMap(BaseFeatureProdPeer::DATABASE_NAME);
    1501:       if (!$dbMap->hasTable(BaseFeatureProdPeer::TABLE_NAME)) {
    1502:         $dbMap->addTableObject(new FeatureProdTableMap());
    1503:       }
    1504:     }
    1505:
    1506:     /**
    1507:      * The class that the Peer will make instances of.
    1508:      *
    1509:      *
    1510:      * @return string ClassName
    1511:      */
    1512:     public static function getOMClass($row = 0, $colnum = 0)
    1513:     {
    1514:         return FeatureProdPeer::OM_CLASS;
    1515:     }
    1516:
    1517:     /**
    1518:      * Performs an INSERT on the database, given a FeatureProd or Criteria object.
    1519:      *
    1520:      * @param      mixed $values Criteria or FeatureProd object containing data that is used to create the INSERT statement.
    1521:      * @param      PropelPDO $con the PropelPDO connection to use
    1522:      * @return mixed           The new primary key.
    1523:      * @throws PropelException Any exceptions caught during processing will be
    1524:      *       rethrown wrapped into a PropelException.
    1525:      */
    1526:     public static function doInsert($values, PropelPDO $con = null)
    1527:     {
    1528:         if ($con === null) {
    1529:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1530:         }
    1531:
    1532:         if ($values instanceof Criteria) {
    1533:             $criteria = clone $values; // rename for clarity
    1534:         } else {
    1535:             $criteria = $values->buildCriteria(); // build Criteria from FeatureProd object
    1536:         }
    1537:
    1538:         if ($criteria->containsKey(FeatureProdPeer::ID) && $criteria->keyContainsValue(FeatureProdPeer::ID) ) {
    1539:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureProdPeer::ID.')');
    1540:         }
    1541:
    1542:
    1543:         // Set the correct dbName
    1544:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1545:
    1546:         try {
    1547:             // use transaction because $criteria could contain info
    1548:             // for more than one table (I guess, conceivably)
    1549:             $con->beginTransaction();
    1550:             $pk = BasePeer::doInsert($criteria, $con);
    1551:             $con->commit();
    1552:         } catch (PropelException $e) {
    1553:             $con->rollBack();
    1554:             throw $e;
    1555:         }
    1556:
    1557:         return $pk;
    1558:     }
    1559:
    1560:     /**
    1561:      * Performs an UPDATE on the database, given a FeatureProd or Criteria object.
    1562:      *
    1563:      * @param      mixed $values Criteria or FeatureProd object containing data that is used to create the UPDATE statement.
    1564:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
    1565:      * @return int             The number of affected rows (if supported by underlying database driver).
    1566:      * @throws PropelException Any exceptions caught during processing will be
    1567:      *       rethrown wrapped into a PropelException.
    1568:      */
    1569:     public static function doUpdate($values, PropelPDO $con = null)
    1570:     {
    1571:         if ($con === null) {
    1572:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1573:         }
    1574:
    1575:         $selectCriteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1576:
    1577:         if ($values instanceof Criteria) {
    1578:             $criteria = clone $values; // rename for clarity
    1579:
    1580:             $comparison = $criteria->getComparison(FeatureProdPeer::ID);
    1581:             $value = $criteria->remove(FeatureProdPeer::ID);
    1582:             if ($value) {
    1583:                 $selectCriteria->add(FeatureProdPeer::ID, $value, $comparison);
    1584:             } else {
    1585:                 $selectCriteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1586:             }
    1587:
    1588:         } else { // $values is FeatureProd object
    1589:             $criteria = $values->buildCriteria(); // gets full criteria
    1590:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    1591:         }
    1592:
    1593:         // set the correct dbName
    1594:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1595:
    1596:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    1597:     }
    1598:
    1599:     /**
    1600:      * Deletes all rows from the feature_prod table.
    1601:      *
    1602:      * @param      PropelPDO $con the connection to use
    1603:      * @return int             The number of affected rows (if supported by underlying database driver).
    1604:      * @throws PropelException
    1605:      */
    1606:     public static function doDeleteAll(PropelPDO $con = null)
    1607:     {
    1608:         if ($con === null) {
    1609:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1610:         }
    1611:         $affectedRows = 0; // initialize var to track total num of affected rows
    1612:         try {
    1613:             // use transaction because $criteria could contain info
    1614:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1615:             $con->beginTransaction();
    1616:             $affectedRows += BasePeer::doDeleteAll(FeatureProdPeer::TABLE_NAME, $con, FeatureProdPeer::DATABASE_NAME);
    1617:             // Because this db requires some delete cascade/set null emulation, we have to
    1618:             // clear the cached instance *after* the emulation has happened (since
    1619:             // instances get re-added by the select statement contained therein).
    1620:             FeatureProdPeer::clearInstancePool();
    1621:             FeatureProdPeer::clearRelatedInstancePool();
    1622:             $con->commit();
    1623:
    1624:             return $affectedRows;
    1625:         } catch (PropelException $e) {
    1626:             $con->rollBack();
    1627:             throw $e;
    1628:         }
    1629:     }
    1630:
    1631:     /**
    1632:      * Performs a DELETE on the database, given a FeatureProd or Criteria object OR a primary key value.
    1633:      *
    1634:      * @param      mixed $values Criteria or FeatureProd object or primary key or array of primary keys
    1635:      *              which is used to create the DELETE statement
    1636:      * @param      PropelPDO $con the connection to use
    1637:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
    1638:      *              if supported by native driver or if emulated using Propel.
    1639:      * @throws PropelException Any exceptions caught during processing will be
    1640:      *       rethrown wrapped into a PropelException.
    1641:      */
    1642:      public static function doDelete($values, PropelPDO $con = null)
    1643:      {
    1644:         if ($con === null) {
    1645:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1646:         }
    1647:
    1648:         if ($values instanceof Criteria) {
    1649:             // invalidate the cache for all objects of this type, since we have no
    1650:             // way of knowing (without running a query) what objects should be invalidated
    1651:             // from the cache based on this Criteria.
    1652:             FeatureProdPeer::clearInstancePool();
    1653:             // rename for clarity
    1654:             $criteria = clone $values;
    1655:         } elseif ($values instanceof FeatureProd) { // it's a model object
    1656:             // invalidate the cache for this single object
    1657:             FeatureProdPeer::removeInstanceFromPool($values);
    1658:             // create criteria based on pk values
    1659:             $criteria = $values->buildPkeyCriteria();
    1660:         } else { // it's a primary key, or an array of pks
    1661:             $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1662:             $criteria->add(FeatureProdPeer::ID, (array) $values, Criteria::IN);
    1663:             // invalidate the cache for this object(s)
    1664:             foreach ((array) $values as $singleval) {
    1665:                 FeatureProdPeer::removeInstanceFromPool($singleval);
    1666:             }
    1667:         }
    1668:
    1669:         // Set the correct dbName
    1670:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1671:
    1672:         $affectedRows = 0; // initialize var to track total num of affected rows
    1673:
    1674:         try {
    1675:             // use transaction because $criteria could contain info
    1676:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1677:             $con->beginTransaction();
    1678:
    1679:             $affectedRows += BasePeer::doDelete($criteria, $con);
    1680:             FeatureProdPeer::clearRelatedInstancePool();
    1681:             $con->commit();
    1682:
    1683:             return $affectedRows;
    1684:         } catch (PropelException $e) {
    1685:             $con->rollBack();
    1686:             throw $e;
    1687:         }
    1688:     }
    1689:
    1690:     /**
    1691:      * Validates all modified columns of given FeatureProd object.
    1692:      * If parameter $columns is either a single column name or an array of column names
    1693:      * than only those columns are validated.
    1694:      *
    1695:      * NOTICE: This does not apply to primary or foreign keys for now.
    1696:      *
    1697:      * @param      FeatureProd $obj The object to validate.
    1698:      * @param      mixed $cols Column name or array of column names.
    1699:      *
    1700:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
    1701:      */
    1702:     public static function doValidate($obj, $cols = null)
    1703:     {
    1704:         $columns = array();
    1705:
    1706:         if ($cols) {
    1707:             $dbMap = Propel::getDatabaseMap(FeatureProdPeer::DATABASE_NAME);
    1708:             $tableMap = $dbMap->getTable(FeatureProdPeer::TABLE_NAME);
    1709:
    1710:             if (! is_array($cols)) {
    1711:                 $cols = array($cols);
    1712:             }
    1713:
    1714:             foreach ($cols as $colName) {
    1715:                 if ($tableMap->hasColumn($colName)) {
    1716:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
    1717:                     $columns[$colName] = $obj->$get();
    1718:                 }
    1719:             }
    1720:         } else {
    1721:
    1722:         }
    1723:
    1724:         return BasePeer::doValidate(FeatureProdPeer::DATABASE_NAME, FeatureProdPeer::TABLE_NAME, $columns);
    1725:     }
    1726:
    1727:     /**
    1728:      * Retrieve a single object by pkey.
    1729:      *
    1730:      * @param      int $pk the primary key.
    1731:      * @param      PropelPDO $con the connection to use
    1732:      * @return FeatureProd
    1733:      */
    1734:     public static function retrieveByPK($pk, PropelPDO $con = null)
    1735:     {
    1736:
    1737:         if (null !== ($obj = FeatureProdPeer::getInstanceFromPool((string) $pk))) {
    1738:             return $obj;
    1739:         }
    1740:
    1741:         if ($con === null) {
    1742:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1743:         }
    1744:
    1745:         $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1746:         $criteria->add(FeatureProdPeer::ID, $pk);
    1747:
    1748:         $v = FeatureProdPeer::doSelect($criteria, $con);
    1749:
    1750:         return !empty($v) > 0 ? $v[0] : null;
    1751:     }
    1752:
    1753:     /**
    1754:      * Retrieve multiple objects by pkey.
    1755:      *
    1756:      * @param      array $pks List of primary keys
    1757:      * @param      PropelPDO $con the connection to use
    1758:      * @return FeatureProd[]
    1759:      * @throws PropelException Any exceptions caught during processing will be
    1760:      *       rethrown wrapped into a PropelException.
    1761:      */
    1762:     public static function retrieveByPKs($pks, PropelPDO $con = null)
    1763:     {
    1764:         if ($con === null) {
    1765:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1766:         }
    1767:
    1768:         $objs = null;
    1769:         if (empty($pks)) {
    1770:             $objs = array();
    1771:         } else {
    1772:             $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1773:             $criteria->add(FeatureProdPeer::ID, $pks, Criteria::IN);
    1774:             $objs = FeatureProdPeer::doSelect($criteria, $con);
    1775:         }
    1776:
    1777:         return $objs;
    1778:     }
    1779:
    1780: } // BaseFeatureProdPeer
    1781:
    1782: // This is the static code needed to register the TableMap for this table with the main Propel class.
    1783: //
    1784: BaseFeatureProdPeer::buildTableMap();
    1785:
    1786: