# File core/lib/Thelia/Model/om/BaseFeatureProdPeer.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\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 durirectly (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()
     393:     {
     394:         FeatureProdPeer::$instances = array();
     395:     }
     396:
     397:     /**
     398:      * Method to invalidate the instance pool of all tables related to feature_prod
     399:      * by a foreign key with ON DELETE CASCADE
     400:      */
     401:     public static function clearRelatedInstancePool()
     402:     {
     403:     }
     404:
     405:     /**
     406:      * 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.
     407:      *
     408:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     409:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     410:      *
     411:      * @param      array $row PropelPDO resultset row.
     412:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     413:      * @return string A string version of PK or null if the components of primary key in result array are all null.
     414:      */
     415:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
     416:     {
     417:         // If the PK cannot be derived from the row, return null.
     418:         if ($row[$startcol] === null) {
     419:             return null;
     420:         }
     421:
     422:         return (string) $row[$startcol];
     423:     }
     424:
     425:     /**
     426:      * Retrieves the primary key from the DB resultset row
     427:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     428:      * a multi-column primary key, an array of the primary key columns will be returned.
     429:      *
     430:      * @param      array $row PropelPDO resultset row.
     431:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     432:      * @return mixed The primary key of the row
     433:      */
     434:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
     435:     {
     436:
     437:         return (int) $row[$startcol];
     438:     }
     439:
     440:     /**
     441:      * The returned array will contain objects of the default type or
     442:      * objects that inherit from the default.
     443:      *
     444:      * @throws PropelException Any exceptions caught during processing will be
     445:      *       rethrown wrapped into a PropelException.
     446:      */
     447:     public static function populateObjects(PDOStatement $stmt)
     448:     {
     449:         $results = array();
     450:
     451:         // set the class once to avoid overhead in the loop
     452:         $cls = FeatureProdPeer::getOMClass();
     453:         // populate the object(s)
     454:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     455:             $key = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     456:             if (null !== ($obj = FeatureProdPeer::getInstanceFromPool($key))) {
     457:                 // We no longer rehydrate the object, since this can cause data loss.
     458:                 // See http://www.propelorm.org/ticket/509
     459:                 // $obj->hydrate($row, 0, true); // rehydrate
     460:                 $results[] = $obj;
     461:             } else {
     462:                 $obj = new $cls();
     463:                 $obj->hydrate($row);
     464:                 $results[] = $obj;
     465:                 FeatureProdPeer::addInstanceToPool($obj, $key);
     466:             } // if key exists
     467:         }
     468:         $stmt->closeCursor();
     469:
     470:         return $results;
     471:     }
     472:     /**
     473:      * Populates an object of the default type or an object that inherit from the default.
     474:      *
     475:      * @param      array $row PropelPDO resultset row.
     476:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     477:      * @throws PropelException Any exceptions caught during processing will be
     478:      *       rethrown wrapped into a PropelException.
     479:      * @return array (FeatureProd object, last column rank)
     480:      */
     481:     public static function populateObject($row, $startcol = 0)
     482:     {
     483:         $key = FeatureProdPeer::getPrimaryKeyHashFromRow($row, $startcol);
     484:         if (null !== ($obj = FeatureProdPeer::getInstanceFromPool($key))) {
     485:             // We no longer rehydrate the object, since this can cause data loss.
     486:             // See http://www.propelorm.org/ticket/509
     487:             // $obj->hydrate($row, $startcol, true); // rehydrate
     488:             $col = $startcol + FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     489:         } else {
     490:             $cls = FeatureProdPeer::OM_CLASS;
     491:             $obj = new $cls();
     492:             $col = $obj->hydrate($row, $startcol);
     493:             FeatureProdPeer::addInstanceToPool($obj, $key);
     494:         }
     495:
     496:         return array($obj, $col);
     497:     }
     498:
     499:
     500:     /**
     501:      * Returns the number of rows matching criteria, joining the related Product table
     502:      *
     503:      * @param      Criteria $criteria
     504:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     505:      * @param      PropelPDO $con
     506:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     507:      * @return int Number of matching rows.
     508:      */
     509:     public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     510:     {
     511:         // we're going to modify criteria, so copy it first
     512:         $criteria = clone $criteria;
     513:
     514:         // We need to set the primary table name, since in the case that there are no WHERE columns
     515:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     516:         // tables go into the FROM clause.
     517:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     518:
     519:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     520:             $criteria->setDistinct();
     521:         }
     522:
     523:         if (!$criteria->hasSelectClause()) {
     524:             FeatureProdPeer::addSelectColumns($criteria);
     525:         }
     526:
     527:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     528:
     529:         // Set the correct dbName
     530:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     531:
     532:         if ($con === null) {
     533:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     534:         }
     535:
     536:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     537:
     538:         $stmt = BasePeer::doCount($criteria, $con);
     539:
     540:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     541:             $count = (int) $row[0];
     542:         } else {
     543:             $count = 0; // no rows returned; we infer that means 0 matches.
     544:         }
     545:         $stmt->closeCursor();
     546:
     547:         return $count;
     548:     }
     549:
     550:
     551:     /**
     552:      * Returns the number of rows matching criteria, joining the related Feature table
     553:      *
     554:      * @param      Criteria $criteria
     555:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     556:      * @param      PropelPDO $con
     557:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     558:      * @return int Number of matching rows.
     559:      */
     560:     public static function doCountJoinFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     561:     {
     562:         // we're going to modify criteria, so copy it first
     563:         $criteria = clone $criteria;
     564:
     565:         // We need to set the primary table name, since in the case that there are no WHERE columns
     566:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     567:         // tables go into the FROM clause.
     568:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     569:
     570:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     571:             $criteria->setDistinct();
     572:         }
     573:
     574:         if (!$criteria->hasSelectClause()) {
     575:             FeatureProdPeer::addSelectColumns($criteria);
     576:         }
     577:
     578:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     579:
     580:         // Set the correct dbName
     581:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     582:
     583:         if ($con === null) {
     584:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     585:         }
     586:
     587:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     588:
     589:         $stmt = BasePeer::doCount($criteria, $con);
     590:
     591:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     592:             $count = (int) $row[0];
     593:         } else {
     594:             $count = 0; // no rows returned; we infer that means 0 matches.
     595:         }
     596:         $stmt->closeCursor();
     597:
     598:         return $count;
     599:     }
     600:
     601:
     602:     /**
     603:      * Returns the number of rows matching criteria, joining the related FeatureAv table
     604:      *
     605:      * @param      Criteria $criteria
     606:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     607:      * @param      PropelPDO $con
     608:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     609:      * @return int Number of matching rows.
     610:      */
     611:     public static function doCountJoinFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     612:     {
     613:         // we're going to modify criteria, so copy it first
     614:         $criteria = clone $criteria;
     615:
     616:         // We need to set the primary table name, since in the case that there are no WHERE columns
     617:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     618:         // tables go into the FROM clause.
     619:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     620:
     621:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     622:             $criteria->setDistinct();
     623:         }
     624:
     625:         if (!$criteria->hasSelectClause()) {
     626:             FeatureProdPeer::addSelectColumns($criteria);
     627:         }
     628:
     629:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     630:
     631:         // Set the correct dbName
     632:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     633:
     634:         if ($con === null) {
     635:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     636:         }
     637:
     638:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     639:
     640:         $stmt = BasePeer::doCount($criteria, $con);
     641:
     642:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     643:             $count = (int) $row[0];
     644:         } else {
     645:             $count = 0; // no rows returned; we infer that means 0 matches.
     646:         }
     647:         $stmt->closeCursor();
     648:
     649:         return $count;
     650:     }
     651:
     652:
     653:     /**
     654:      * Selects a collection of FeatureProd objects pre-filled with their Product objects.
     655:      * @param      Criteria  $criteria
     656:      * @param      PropelPDO $con
     657:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     658:      * @return array           Array of FeatureProd objects.
     659:      * @throws PropelException Any exceptions caught during processing will be
     660:      *       rethrown wrapped into a PropelException.
     661:      */
     662:     public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     663:     {
     664:         $criteria = clone $criteria;
     665:
     666:         // Set the correct dbName if it has not been overridden
     667:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     668:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     669:         }
     670:
     671:         FeatureProdPeer::addSelectColumns($criteria);
     672:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     673:         ProductPeer::addSelectColumns($criteria);
     674:
     675:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     676:
     677:         $stmt = BasePeer::doSelect($criteria, $con);
     678:         $results = array();
     679:
     680:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     681:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     682:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     683:                 // We no longer rehydrate the object, since this can cause data loss.
     684:                 // See http://www.propelorm.org/ticket/509
     685:                 // $obj1->hydrate($row, 0, true); // rehydrate
     686:             } else {
     687:
     688:                 $cls = FeatureProdPeer::getOMClass();
     689:
     690:                 $obj1 = new $cls();
     691:                 $obj1->hydrate($row);
     692:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     693:             } // if $obj1 already loaded
     694:
     695:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
     696:             if ($key2 !== null) {
     697:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
     698:                 if (!$obj2) {
     699:
     700:                     $cls = ProductPeer::getOMClass();
     701:
     702:                     $obj2 = new $cls();
     703:                     $obj2->hydrate($row, $startcol);
     704:                     ProductPeer::addInstanceToPool($obj2, $key2);
     705:                 } // if obj2 already loaded
     706:
     707:                 // Add the $obj1 (FeatureProd) to $obj2 (Product)
     708:                 $obj2->addFeatureProd($obj1);
     709:
     710:             } // if joined row was not null
     711:
     712:             $results[] = $obj1;
     713:         }
     714:         $stmt->closeCursor();
     715:
     716:         return $results;
     717:     }
     718:
     719:
     720:     /**
     721:      * Selects a collection of FeatureProd objects pre-filled with their Feature objects.
     722:      * @param      Criteria  $criteria
     723:      * @param      PropelPDO $con
     724:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     725:      * @return array           Array of FeatureProd objects.
     726:      * @throws PropelException Any exceptions caught during processing will be
     727:      *       rethrown wrapped into a PropelException.
     728:      */
     729:     public static function doSelectJoinFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     730:     {
     731:         $criteria = clone $criteria;
     732:
     733:         // Set the correct dbName if it has not been overridden
     734:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     735:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     736:         }
     737:
     738:         FeatureProdPeer::addSelectColumns($criteria);
     739:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     740:         FeaturePeer::addSelectColumns($criteria);
     741:
     742:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     743:
     744:         $stmt = BasePeer::doSelect($criteria, $con);
     745:         $results = array();
     746:
     747:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     748:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     749:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     750:                 // We no longer rehydrate the object, since this can cause data loss.
     751:                 // See http://www.propelorm.org/ticket/509
     752:                 // $obj1->hydrate($row, 0, true); // rehydrate
     753:             } else {
     754:
     755:                 $cls = FeatureProdPeer::getOMClass();
     756:
     757:                 $obj1 = new $cls();
     758:                 $obj1->hydrate($row);
     759:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     760:             } // if $obj1 already loaded
     761:
     762:             $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol);
     763:             if ($key2 !== null) {
     764:                 $obj2 = FeaturePeer::getInstanceFromPool($key2);
     765:                 if (!$obj2) {
     766:
     767:                     $cls = FeaturePeer::getOMClass();
     768:
     769:                     $obj2 = new $cls();
     770:                     $obj2->hydrate($row, $startcol);
     771:                     FeaturePeer::addInstanceToPool($obj2, $key2);
     772:                 } // if obj2 already loaded
     773:
     774:                 // Add the $obj1 (FeatureProd) to $obj2 (Feature)
     775:                 $obj2->addFeatureProd($obj1);
     776:
     777:             } // if joined row was not null
     778:
     779:             $results[] = $obj1;
     780:         }
     781:         $stmt->closeCursor();
     782:
     783:         return $results;
     784:     }
     785:
     786:
     787:     /**
     788:      * Selects a collection of FeatureProd objects pre-filled with their FeatureAv objects.
     789:      * @param      Criteria  $criteria
     790:      * @param      PropelPDO $con
     791:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     792:      * @return array           Array of FeatureProd objects.
     793:      * @throws PropelException Any exceptions caught during processing will be
     794:      *       rethrown wrapped into a PropelException.
     795:      */
     796:     public static function doSelectJoinFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     797:     {
     798:         $criteria = clone $criteria;
     799:
     800:         // Set the correct dbName if it has not been overridden
     801:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     802:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     803:         }
     804:
     805:         FeatureProdPeer::addSelectColumns($criteria);
     806:         $startcol = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     807:         FeatureAvPeer::addSelectColumns($criteria);
     808:
     809:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     810:
     811:         $stmt = BasePeer::doSelect($criteria, $con);
     812:         $results = array();
     813:
     814:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     815:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     816:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     817:                 // We no longer rehydrate the object, since this can cause data loss.
     818:                 // See http://www.propelorm.org/ticket/509
     819:                 // $obj1->hydrate($row, 0, true); // rehydrate
     820:             } else {
     821:
     822:                 $cls = FeatureProdPeer::getOMClass();
     823:
     824:                 $obj1 = new $cls();
     825:                 $obj1->hydrate($row);
     826:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     827:             } // if $obj1 already loaded
     828:
     829:             $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
     830:             if ($key2 !== null) {
     831:                 $obj2 = FeatureAvPeer::getInstanceFromPool($key2);
     832:                 if (!$obj2) {
     833:
     834:                     $cls = FeatureAvPeer::getOMClass();
     835:
     836:                     $obj2 = new $cls();
     837:                     $obj2->hydrate($row, $startcol);
     838:                     FeatureAvPeer::addInstanceToPool($obj2, $key2);
     839:                 } // if obj2 already loaded
     840:
     841:                 // Add the $obj1 (FeatureProd) to $obj2 (FeatureAv)
     842:                 $obj2->addFeatureProd($obj1);
     843:
     844:             } // if joined row was not null
     845:
     846:             $results[] = $obj1;
     847:         }
     848:         $stmt->closeCursor();
     849:
     850:         return $results;
     851:     }
     852:
     853:
     854:     /**
     855:      * Returns the number of rows matching criteria, joining all related tables
     856:      *
     857:      * @param      Criteria $criteria
     858:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     859:      * @param      PropelPDO $con
     860:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     861:      * @return int Number of matching rows.
     862:      */
     863:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     864:     {
     865:         // we're going to modify criteria, so copy it first
     866:         $criteria = clone $criteria;
     867:
     868:         // We need to set the primary table name, since in the case that there are no WHERE columns
     869:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     870:         // tables go into the FROM clause.
     871:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
     872:
     873:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     874:             $criteria->setDistinct();
     875:         }
     876:
     877:         if (!$criteria->hasSelectClause()) {
     878:             FeatureProdPeer::addSelectColumns($criteria);
     879:         }
     880:
     881:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     882:
     883:         // Set the correct dbName
     884:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     885:
     886:         if ($con === null) {
     887:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     888:         }
     889:
     890:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     891:
     892:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     893:
     894:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     895:
     896:         $stmt = BasePeer::doCount($criteria, $con);
     897:
     898:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     899:             $count = (int) $row[0];
     900:         } else {
     901:             $count = 0; // no rows returned; we infer that means 0 matches.
     902:         }
     903:         $stmt->closeCursor();
     904:
     905:         return $count;
     906:     }
     907:
     908:     /**
     909:      * Selects a collection of FeatureProd objects pre-filled with all related objects.
     910:      *
     911:      * @param      Criteria  $criteria
     912:      * @param      PropelPDO $con
     913:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     914:      * @return array           Array of FeatureProd objects.
     915:      * @throws PropelException Any exceptions caught during processing will be
     916:      *       rethrown wrapped into a PropelException.
     917:      */
     918:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     919:     {
     920:         $criteria = clone $criteria;
     921:
     922:         // Set the correct dbName if it has not been overridden
     923:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     924:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
     925:         }
     926:
     927:         FeatureProdPeer::addSelectColumns($criteria);
     928:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
     929:
     930:         ProductPeer::addSelectColumns($criteria);
     931:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
     932:
     933:         FeaturePeer::addSelectColumns($criteria);
     934:         $startcol4 = $startcol3 + FeaturePeer::NUM_HYDRATE_COLUMNS;
     935:
     936:         FeatureAvPeer::addSelectColumns($criteria);
     937:         $startcol5 = $startcol4 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
     938:
     939:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
     940:
     941:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
     942:
     943:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
     944:
     945:         $stmt = BasePeer::doSelect($criteria, $con);
     946:         $results = array();
     947:
     948:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     949:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
     950:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
     951:                 // We no longer rehydrate the object, since this can cause data loss.
     952:                 // See http://www.propelorm.org/ticket/509
     953:                 // $obj1->hydrate($row, 0, true); // rehydrate
     954:             } else {
     955:                 $cls = FeatureProdPeer::getOMClass();
     956:
     957:                 $obj1 = new $cls();
     958:                 $obj1->hydrate($row);
     959:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
     960:             } // if obj1 already loaded
     961:
     962:             // Add objects for joined Product rows
     963:
     964:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
     965:             if ($key2 !== null) {
     966:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
     967:                 if (!$obj2) {
     968:
     969:                     $cls = ProductPeer::getOMClass();
     970:
     971:                     $obj2 = new $cls();
     972:                     $obj2->hydrate($row, $startcol2);
     973:                     ProductPeer::addInstanceToPool($obj2, $key2);
     974:                 } // if obj2 loaded
     975:
     976:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
     977:                 $obj2->addFeatureProd($obj1);
     978:             } // if joined row not null
     979:
     980:             // Add objects for joined Feature rows
     981:
     982:             $key3 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol3);
     983:             if ($key3 !== null) {
     984:                 $obj3 = FeaturePeer::getInstanceFromPool($key3);
     985:                 if (!$obj3) {
     986:
     987:                     $cls = FeaturePeer::getOMClass();
     988:
     989:                     $obj3 = new $cls();
     990:                     $obj3->hydrate($row, $startcol3);
     991:                     FeaturePeer::addInstanceToPool($obj3, $key3);
     992:                 } // if obj3 loaded
     993:
     994:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (Feature)
     995:                 $obj3->addFeatureProd($obj1);
     996:             } // if joined row not null
     997:
     998:             // Add objects for joined FeatureAv rows
     999:
    1000:             $key4 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol4);
    1001:             if ($key4 !== null) {
    1002:                 $obj4 = FeatureAvPeer::getInstanceFromPool($key4);
    1003:                 if (!$obj4) {
    1004:
    1005:                     $cls = FeatureAvPeer::getOMClass();
    1006:
    1007:                     $obj4 = new $cls();
    1008:                     $obj4->hydrate($row, $startcol4);
    1009:                     FeatureAvPeer::addInstanceToPool($obj4, $key4);
    1010:                 } // if obj4 loaded
    1011:
    1012:                 // Add the $obj1 (FeatureProd) to the collection in $obj4 (FeatureAv)
    1013:                 $obj4->addFeatureProd($obj1);
    1014:             } // if joined row not null
    1015:
    1016:             $results[] = $obj1;
    1017:         }
    1018:         $stmt->closeCursor();
    1019:
    1020:         return $results;
    1021:     }
    1022:
    1023:
    1024:     /**
    1025:      * Returns the number of rows matching criteria, joining the related Product table
    1026:      *
    1027:      * @param      Criteria $criteria
    1028:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1029:      * @param      PropelPDO $con
    1030:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1031:      * @return int Number of matching rows.
    1032:      */
    1033:     public static function doCountJoinAllExceptProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1034:     {
    1035:         // we're going to modify criteria, so copy it first
    1036:         $criteria = clone $criteria;
    1037:
    1038:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1039:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1040:         // tables go into the FROM clause.
    1041:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1042:
    1043:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1044:             $criteria->setDistinct();
    1045:         }
    1046:
    1047:         if (!$criteria->hasSelectClause()) {
    1048:             FeatureProdPeer::addSelectColumns($criteria);
    1049:         }
    1050:
    1051:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1052:
    1053:         // Set the correct dbName
    1054:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1055:
    1056:         if ($con === null) {
    1057:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1058:         }
    1059:
    1060:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1061:
    1062:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1063:
    1064:         $stmt = BasePeer::doCount($criteria, $con);
    1065:
    1066:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1067:             $count = (int) $row[0];
    1068:         } else {
    1069:             $count = 0; // no rows returned; we infer that means 0 matches.
    1070:         }
    1071:         $stmt->closeCursor();
    1072:
    1073:         return $count;
    1074:     }
    1075:
    1076:
    1077:     /**
    1078:      * Returns the number of rows matching criteria, joining the related Feature table
    1079:      *
    1080:      * @param      Criteria $criteria
    1081:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1082:      * @param      PropelPDO $con
    1083:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1084:      * @return int Number of matching rows.
    1085:      */
    1086:     public static function doCountJoinAllExceptFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1087:     {
    1088:         // we're going to modify criteria, so copy it first
    1089:         $criteria = clone $criteria;
    1090:
    1091:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1092:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1093:         // tables go into the FROM clause.
    1094:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1095:
    1096:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1097:             $criteria->setDistinct();
    1098:         }
    1099:
    1100:         if (!$criteria->hasSelectClause()) {
    1101:             FeatureProdPeer::addSelectColumns($criteria);
    1102:         }
    1103:
    1104:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1105:
    1106:         // Set the correct dbName
    1107:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1108:
    1109:         if ($con === null) {
    1110:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1111:         }
    1112:
    1113:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1114:
    1115:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1116:
    1117:         $stmt = BasePeer::doCount($criteria, $con);
    1118:
    1119:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1120:             $count = (int) $row[0];
    1121:         } else {
    1122:             $count = 0; // no rows returned; we infer that means 0 matches.
    1123:         }
    1124:         $stmt->closeCursor();
    1125:
    1126:         return $count;
    1127:     }
    1128:
    1129:
    1130:     /**
    1131:      * Returns the number of rows matching criteria, joining the related FeatureAv table
    1132:      *
    1133:      * @param      Criteria $criteria
    1134:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1135:      * @param      PropelPDO $con
    1136:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1137:      * @return int Number of matching rows.
    1138:      */
    1139:     public static function doCountJoinAllExceptFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1140:     {
    1141:         // we're going to modify criteria, so copy it first
    1142:         $criteria = clone $criteria;
    1143:
    1144:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1145:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1146:         // tables go into the FROM clause.
    1147:         $criteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1148:
    1149:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1150:             $criteria->setDistinct();
    1151:         }
    1152:
    1153:         if (!$criteria->hasSelectClause()) {
    1154:             FeatureProdPeer::addSelectColumns($criteria);
    1155:         }
    1156:
    1157:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1158:
    1159:         // Set the correct dbName
    1160:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1161:
    1162:         if ($con === null) {
    1163:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1164:         }
    1165:
    1166:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1167:
    1168:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1169:
    1170:         $stmt = BasePeer::doCount($criteria, $con);
    1171:
    1172:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1173:             $count = (int) $row[0];
    1174:         } else {
    1175:             $count = 0; // no rows returned; we infer that means 0 matches.
    1176:         }
    1177:         $stmt->closeCursor();
    1178:
    1179:         return $count;
    1180:     }
    1181:
    1182:
    1183:     /**
    1184:      * Selects a collection of FeatureProd objects pre-filled with all related objects except Product.
    1185:      *
    1186:      * @param      Criteria  $criteria
    1187:      * @param      PropelPDO $con
    1188:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1189:      * @return array           Array of FeatureProd objects.
    1190:      * @throws PropelException Any exceptions caught during processing will be
    1191:      *       rethrown wrapped into a PropelException.
    1192:      */
    1193:     public static function doSelectJoinAllExceptProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1194:     {
    1195:         $criteria = clone $criteria;
    1196:
    1197:         // Set the correct dbName if it has not been overridden
    1198:         // $criteria->getDbName() will return the same object if not set to another value
    1199:         // so == check is okay and faster
    1200:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1201:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1202:         }
    1203:
    1204:         FeatureProdPeer::addSelectColumns($criteria);
    1205:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1206:
    1207:         FeaturePeer::addSelectColumns($criteria);
    1208:         $startcol3 = $startcol2 + FeaturePeer::NUM_HYDRATE_COLUMNS;
    1209:
    1210:         FeatureAvPeer::addSelectColumns($criteria);
    1211:         $startcol4 = $startcol3 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
    1212:
    1213:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1214:
    1215:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1216:
    1217:
    1218:         $stmt = BasePeer::doSelect($criteria, $con);
    1219:         $results = array();
    1220:
    1221:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1222:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1223:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1224:                 // We no longer rehydrate the object, since this can cause data loss.
    1225:                 // See http://www.propelorm.org/ticket/509
    1226:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1227:             } else {
    1228:                 $cls = FeatureProdPeer::getOMClass();
    1229:
    1230:                 $obj1 = new $cls();
    1231:                 $obj1->hydrate($row);
    1232:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1233:             } // if obj1 already loaded
    1234:
    1235:                 // Add objects for joined Feature rows
    1236:
    1237:                 $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1238:                 if ($key2 !== null) {
    1239:                     $obj2 = FeaturePeer::getInstanceFromPool($key2);
    1240:                     if (!$obj2) {
    1241:
    1242:                         $cls = FeaturePeer::getOMClass();
    1243:
    1244:                     $obj2 = new $cls();
    1245:                     $obj2->hydrate($row, $startcol2);
    1246:                     FeaturePeer::addInstanceToPool($obj2, $key2);
    1247:                 } // if $obj2 already loaded
    1248:
    1249:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Feature)
    1250:                 $obj2->addFeatureProd($obj1);
    1251:
    1252:             } // if joined row is not null
    1253:
    1254:                 // Add objects for joined FeatureAv rows
    1255:
    1256:                 $key3 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1257:                 if ($key3 !== null) {
    1258:                     $obj3 = FeatureAvPeer::getInstanceFromPool($key3);
    1259:                     if (!$obj3) {
    1260:
    1261:                         $cls = FeatureAvPeer::getOMClass();
    1262:
    1263:                     $obj3 = new $cls();
    1264:                     $obj3->hydrate($row, $startcol3);
    1265:                     FeatureAvPeer::addInstanceToPool($obj3, $key3);
    1266:                 } // if $obj3 already loaded
    1267:
    1268:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (FeatureAv)
    1269:                 $obj3->addFeatureProd($obj1);
    1270:
    1271:             } // if joined row is not null
    1272:
    1273:             $results[] = $obj1;
    1274:         }
    1275:         $stmt->closeCursor();
    1276:
    1277:         return $results;
    1278:     }
    1279:
    1280:
    1281:     /**
    1282:      * Selects a collection of FeatureProd objects pre-filled with all related objects except Feature.
    1283:      *
    1284:      * @param      Criteria  $criteria
    1285:      * @param      PropelPDO $con
    1286:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1287:      * @return array           Array of FeatureProd objects.
    1288:      * @throws PropelException Any exceptions caught during processing will be
    1289:      *       rethrown wrapped into a PropelException.
    1290:      */
    1291:     public static function doSelectJoinAllExceptFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1292:     {
    1293:         $criteria = clone $criteria;
    1294:
    1295:         // Set the correct dbName if it has not been overridden
    1296:         // $criteria->getDbName() will return the same object if not set to another value
    1297:         // so == check is okay and faster
    1298:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1299:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1300:         }
    1301:
    1302:         FeatureProdPeer::addSelectColumns($criteria);
    1303:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1304:
    1305:         ProductPeer::addSelectColumns($criteria);
    1306:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
    1307:
    1308:         FeatureAvPeer::addSelectColumns($criteria);
    1309:         $startcol4 = $startcol3 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
    1310:
    1311:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1312:
    1313:         $criteria->addJoin(FeatureProdPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior);
    1314:
    1315:
    1316:         $stmt = BasePeer::doSelect($criteria, $con);
    1317:         $results = array();
    1318:
    1319:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1320:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1321:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1322:                 // We no longer rehydrate the object, since this can cause data loss.
    1323:                 // See http://www.propelorm.org/ticket/509
    1324:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1325:             } else {
    1326:                 $cls = FeatureProdPeer::getOMClass();
    1327:
    1328:                 $obj1 = new $cls();
    1329:                 $obj1->hydrate($row);
    1330:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1331:             } // if obj1 already loaded
    1332:
    1333:                 // Add objects for joined Product rows
    1334:
    1335:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1336:                 if ($key2 !== null) {
    1337:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
    1338:                     if (!$obj2) {
    1339:
    1340:                         $cls = ProductPeer::getOMClass();
    1341:
    1342:                     $obj2 = new $cls();
    1343:                     $obj2->hydrate($row, $startcol2);
    1344:                     ProductPeer::addInstanceToPool($obj2, $key2);
    1345:                 } // if $obj2 already loaded
    1346:
    1347:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
    1348:                 $obj2->addFeatureProd($obj1);
    1349:
    1350:             } // if joined row is not null
    1351:
    1352:                 // Add objects for joined FeatureAv rows
    1353:
    1354:                 $key3 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1355:                 if ($key3 !== null) {
    1356:                     $obj3 = FeatureAvPeer::getInstanceFromPool($key3);
    1357:                     if (!$obj3) {
    1358:
    1359:                         $cls = FeatureAvPeer::getOMClass();
    1360:
    1361:                     $obj3 = new $cls();
    1362:                     $obj3->hydrate($row, $startcol3);
    1363:                     FeatureAvPeer::addInstanceToPool($obj3, $key3);
    1364:                 } // if $obj3 already loaded
    1365:
    1366:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (FeatureAv)
    1367:                 $obj3->addFeatureProd($obj1);
    1368:
    1369:             } // if joined row is not null
    1370:
    1371:             $results[] = $obj1;
    1372:         }
    1373:         $stmt->closeCursor();
    1374:
    1375:         return $results;
    1376:     }
    1377:
    1378:
    1379:     /**
    1380:      * Selects a collection of FeatureProd objects pre-filled with all related objects except FeatureAv.
    1381:      *
    1382:      * @param      Criteria  $criteria
    1383:      * @param      PropelPDO $con
    1384:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1385:      * @return array           Array of FeatureProd objects.
    1386:      * @throws PropelException Any exceptions caught during processing will be
    1387:      *       rethrown wrapped into a PropelException.
    1388:      */
    1389:     public static function doSelectJoinAllExceptFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1390:     {
    1391:         $criteria = clone $criteria;
    1392:
    1393:         // Set the correct dbName if it has not been overridden
    1394:         // $criteria->getDbName() will return the same object if not set to another value
    1395:         // so == check is okay and faster
    1396:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1397:             $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1398:         }
    1399:
    1400:         FeatureProdPeer::addSelectColumns($criteria);
    1401:         $startcol2 = FeatureProdPeer::NUM_HYDRATE_COLUMNS;
    1402:
    1403:         ProductPeer::addSelectColumns($criteria);
    1404:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
    1405:
    1406:         FeaturePeer::addSelectColumns($criteria);
    1407:         $startcol4 = $startcol3 + FeaturePeer::NUM_HYDRATE_COLUMNS;
    1408:
    1409:         $criteria->addJoin(FeatureProdPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
    1410:
    1411:         $criteria->addJoin(FeatureProdPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
    1412:
    1413:
    1414:         $stmt = BasePeer::doSelect($criteria, $con);
    1415:         $results = array();
    1416:
    1417:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1418:             $key1 = FeatureProdPeer::getPrimaryKeyHashFromRow($row, 0);
    1419:             if (null !== ($obj1 = FeatureProdPeer::getInstanceFromPool($key1))) {
    1420:                 // We no longer rehydrate the object, since this can cause data loss.
    1421:                 // See http://www.propelorm.org/ticket/509
    1422:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1423:             } else {
    1424:                 $cls = FeatureProdPeer::getOMClass();
    1425:
    1426:                 $obj1 = new $cls();
    1427:                 $obj1->hydrate($row);
    1428:                 FeatureProdPeer::addInstanceToPool($obj1, $key1);
    1429:             } // if obj1 already loaded
    1430:
    1431:                 // Add objects for joined Product rows
    1432:
    1433:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1434:                 if ($key2 !== null) {
    1435:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
    1436:                     if (!$obj2) {
    1437:
    1438:                         $cls = ProductPeer::getOMClass();
    1439:
    1440:                     $obj2 = new $cls();
    1441:                     $obj2->hydrate($row, $startcol2);
    1442:                     ProductPeer::addInstanceToPool($obj2, $key2);
    1443:                 } // if $obj2 already loaded
    1444:
    1445:                 // Add the $obj1 (FeatureProd) to the collection in $obj2 (Product)
    1446:                 $obj2->addFeatureProd($obj1);
    1447:
    1448:             } // if joined row is not null
    1449:
    1450:                 // Add objects for joined Feature rows
    1451:
    1452:                 $key3 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1453:                 if ($key3 !== null) {
    1454:                     $obj3 = FeaturePeer::getInstanceFromPool($key3);
    1455:                     if (!$obj3) {
    1456:
    1457:                         $cls = FeaturePeer::getOMClass();
    1458:
    1459:                     $obj3 = new $cls();
    1460:                     $obj3->hydrate($row, $startcol3);
    1461:                     FeaturePeer::addInstanceToPool($obj3, $key3);
    1462:                 } // if $obj3 already loaded
    1463:
    1464:                 // Add the $obj1 (FeatureProd) to the collection in $obj3 (Feature)
    1465:                 $obj3->addFeatureProd($obj1);
    1466:
    1467:             } // if joined row is not null
    1468:
    1469:             $results[] = $obj1;
    1470:         }
    1471:         $stmt->closeCursor();
    1472:
    1473:         return $results;
    1474:     }
    1475:
    1476:     /**
    1477:      * Returns the TableMap related to this peer.
    1478:      * This method is not needed for general use but a specific application could have a need.
    1479:      * @return TableMap
    1480:      * @throws PropelException Any exceptions caught during processing will be
    1481:      *       rethrown wrapped into a PropelException.
    1482:      */
    1483:     public static function getTableMap()
    1484:     {
    1485:         return Propel::getDatabaseMap(FeatureProdPeer::DATABASE_NAME)->getTable(FeatureProdPeer::TABLE_NAME);
    1486:     }
    1487:
    1488:     /**
    1489:      * Add a TableMap instance to the database for this peer class.
    1490:      */
    1491:     public static function buildTableMap()
    1492:     {
    1493:       $dbMap = Propel::getDatabaseMap(BaseFeatureProdPeer::DATABASE_NAME);
    1494:       if (!$dbMap->hasTable(BaseFeatureProdPeer::TABLE_NAME)) {
    1495:         $dbMap->addTableObject(new FeatureProdTableMap());
    1496:       }
    1497:     }
    1498:
    1499:     /**
    1500:      * The class that the Peer will make instances of.
    1501:      *
    1502:      *
    1503:      * @return string ClassName
    1504:      */
    1505:     public static function getOMClass()
    1506:     {
    1507:         return FeatureProdPeer::OM_CLASS;
    1508:     }
    1509:
    1510:     /**
    1511:      * Performs an INSERT on the database, given a FeatureProd or Criteria object.
    1512:      *
    1513:      * @param      mixed $values Criteria or FeatureProd object containing data that is used to create the INSERT statement.
    1514:      * @param      PropelPDO $con the PropelPDO connection to use
    1515:      * @return mixed           The new primary key.
    1516:      * @throws PropelException Any exceptions caught during processing will be
    1517:      *       rethrown wrapped into a PropelException.
    1518:      */
    1519:     public static function doInsert($values, PropelPDO $con = null)
    1520:     {
    1521:         if ($con === null) {
    1522:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1523:         }
    1524:
    1525:         if ($values instanceof Criteria) {
    1526:             $criteria = clone $values; // rename for clarity
    1527:         } else {
    1528:             $criteria = $values->buildCriteria(); // build Criteria from FeatureProd object
    1529:         }
    1530:
    1531:         if ($criteria->containsKey(FeatureProdPeer::ID) && $criteria->keyContainsValue(FeatureProdPeer::ID) ) {
    1532:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureProdPeer::ID.')');
    1533:         }
    1534:
    1535:
    1536:         // Set the correct dbName
    1537:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1538:
    1539:         try {
    1540:             // use transaction because $criteria could contain info
    1541:             // for more than one table (I guess, conceivably)
    1542:             $con->beginTransaction();
    1543:             $pk = BasePeer::doInsert($criteria, $con);
    1544:             $con->commit();
    1545:         } catch (PropelException $e) {
    1546:             $con->rollBack();
    1547:             throw $e;
    1548:         }
    1549:
    1550:         return $pk;
    1551:     }
    1552:
    1553:     /**
    1554:      * Performs an UPDATE on the database, given a FeatureProd or Criteria object.
    1555:      *
    1556:      * @param      mixed $values Criteria or FeatureProd object containing data that is used to create the UPDATE statement.
    1557:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
    1558:      * @return int             The number of affected rows (if supported by underlying database driver).
    1559:      * @throws PropelException Any exceptions caught during processing will be
    1560:      *       rethrown wrapped into a PropelException.
    1561:      */
    1562:     public static function doUpdate($values, PropelPDO $con = null)
    1563:     {
    1564:         if ($con === null) {
    1565:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1566:         }
    1567:
    1568:         $selectCriteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1569:
    1570:         if ($values instanceof Criteria) {
    1571:             $criteria = clone $values; // rename for clarity
    1572:
    1573:             $comparison = $criteria->getComparison(FeatureProdPeer::ID);
    1574:             $value = $criteria->remove(FeatureProdPeer::ID);
    1575:             if ($value) {
    1576:                 $selectCriteria->add(FeatureProdPeer::ID, $value, $comparison);
    1577:             } else {
    1578:                 $selectCriteria->setPrimaryTableName(FeatureProdPeer::TABLE_NAME);
    1579:             }
    1580:
    1581:         } else { // $values is FeatureProd object
    1582:             $criteria = $values->buildCriteria(); // gets full criteria
    1583:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    1584:         }
    1585:
    1586:         // set the correct dbName
    1587:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1588:
    1589:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    1590:     }
    1591:
    1592:     /**
    1593:      * Deletes all rows from the feature_prod table.
    1594:      *
    1595:      * @param      PropelPDO $con the connection to use
    1596:      * @return int             The number of affected rows (if supported by underlying database driver).
    1597:      * @throws PropelException
    1598:      */
    1599:     public static function doDeleteAll(PropelPDO $con = null)
    1600:     {
    1601:         if ($con === null) {
    1602:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1603:         }
    1604:         $affectedRows = 0; // initialize var to track total num of affected rows
    1605:         try {
    1606:             // use transaction because $criteria could contain info
    1607:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1608:             $con->beginTransaction();
    1609:             $affectedRows += BasePeer::doDeleteAll(FeatureProdPeer::TABLE_NAME, $con, FeatureProdPeer::DATABASE_NAME);
    1610:             // Because this db requires some delete cascade/set null emulation, we have to
    1611:             // clear the cached instance *after* the emulation has happened (since
    1612:             // instances get re-added by the select statement contained therein).
    1613:             FeatureProdPeer::clearInstancePool();
    1614:             FeatureProdPeer::clearRelatedInstancePool();
    1615:             $con->commit();
    1616:
    1617:             return $affectedRows;
    1618:         } catch (PropelException $e) {
    1619:             $con->rollBack();
    1620:             throw $e;
    1621:         }
    1622:     }
    1623:
    1624:     /**
    1625:      * Performs a DELETE on the database, given a FeatureProd or Criteria object OR a primary key value.
    1626:      *
    1627:      * @param      mixed $values Criteria or FeatureProd object or primary key or array of primary keys
    1628:      *              which is used to create the DELETE statement
    1629:      * @param      PropelPDO $con the connection to use
    1630:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
    1631:      *              if supported by native driver or if emulated using Propel.
    1632:      * @throws PropelException Any exceptions caught during processing will be
    1633:      *       rethrown wrapped into a PropelException.
    1634:      */
    1635:      public static function doDelete($values, PropelPDO $con = null)
    1636:      {
    1637:         if ($con === null) {
    1638:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1639:         }
    1640:
    1641:         if ($values instanceof Criteria) {
    1642:             // invalidate the cache for all objects of this type, since we have no
    1643:             // way of knowing (without running a query) what objects should be invalidated
    1644:             // from the cache based on this Criteria.
    1645:             FeatureProdPeer::clearInstancePool();
    1646:             // rename for clarity
    1647:             $criteria = clone $values;
    1648:         } elseif ($values instanceof FeatureProd) { // it's a model object
    1649:             // invalidate the cache for this single object
    1650:             FeatureProdPeer::removeInstanceFromPool($values);
    1651:             // create criteria based on pk values
    1652:             $criteria = $values->buildPkeyCriteria();
    1653:         } else { // it's a primary key, or an array of pks
    1654:             $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1655:             $criteria->add(FeatureProdPeer::ID, (array) $values, Criteria::IN);
    1656:             // invalidate the cache for this object(s)
    1657:             foreach ((array) $values as $singleval) {
    1658:                 FeatureProdPeer::removeInstanceFromPool($singleval);
    1659:             }
    1660:         }
    1661:
    1662:         // Set the correct dbName
    1663:         $criteria->setDbName(FeatureProdPeer::DATABASE_NAME);
    1664:
    1665:         $affectedRows = 0; // initialize var to track total num of affected rows
    1666:
    1667:         try {
    1668:             // use transaction because $criteria could contain info
    1669:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1670:             $con->beginTransaction();
    1671:
    1672:             $affectedRows += BasePeer::doDelete($criteria, $con);
    1673:             FeatureProdPeer::clearRelatedInstancePool();
    1674:             $con->commit();
    1675:
    1676:             return $affectedRows;
    1677:         } catch (PropelException $e) {
    1678:             $con->rollBack();
    1679:             throw $e;
    1680:         }
    1681:     }
    1682:
    1683:     /**
    1684:      * Validates all modified columns of given FeatureProd object.
    1685:      * If parameter $columns is either a single column name or an array of column names
    1686:      * than only those columns are validated.
    1687:      *
    1688:      * NOTICE: This does not apply to primary or foreign keys for now.
    1689:      *
    1690:      * @param      FeatureProd $obj The object to validate.
    1691:      * @param      mixed $cols Column name or array of column names.
    1692:      *
    1693:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
    1694:      */
    1695:     public static function doValidate($obj, $cols = null)
    1696:     {
    1697:         $columns = array();
    1698:
    1699:         if ($cols) {
    1700:             $dbMap = Propel::getDatabaseMap(FeatureProdPeer::DATABASE_NAME);
    1701:             $tableMap = $dbMap->getTable(FeatureProdPeer::TABLE_NAME);
    1702:
    1703:             if (! is_array($cols)) {
    1704:                 $cols = array($cols);
    1705:             }
    1706:
    1707:             foreach ($cols as $colName) {
    1708:                 if ($tableMap->hasColumn($colName)) {
    1709:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
    1710:                     $columns[$colName] = $obj->$get();
    1711:                 }
    1712:             }
    1713:         } else {
    1714:
    1715:         }
    1716:
    1717:         return BasePeer::doValidate(FeatureProdPeer::DATABASE_NAME, FeatureProdPeer::TABLE_NAME, $columns);
    1718:     }
    1719:
    1720:     /**
    1721:      * Retrieve a single object by pkey.
    1722:      *
    1723:      * @param      int $pk the primary key.
    1724:      * @param      PropelPDO $con the connection to use
    1725:      * @return FeatureProd
    1726:      */
    1727:     public static function retrieveByPK($pk, PropelPDO $con = null)
    1728:     {
    1729:
    1730:         if (null !== ($obj = FeatureProdPeer::getInstanceFromPool((string) $pk))) {
    1731:             return $obj;
    1732:         }
    1733:
    1734:         if ($con === null) {
    1735:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1736:         }
    1737:
    1738:         $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1739:         $criteria->add(FeatureProdPeer::ID, $pk);
    1740:
    1741:         $v = FeatureProdPeer::doSelect($criteria, $con);
    1742:
    1743:         return !empty($v) > 0 ? $v[0] : null;
    1744:     }
    1745:
    1746:     /**
    1747:      * Retrieve multiple objects by pkey.
    1748:      *
    1749:      * @param      array $pks List of primary keys
    1750:      * @param      PropelPDO $con the connection to use
    1751:      * @return FeatureProd[]
    1752:      * @throws PropelException Any exceptions caught during processing will be
    1753:      *       rethrown wrapped into a PropelException.
    1754:      */
    1755:     public static function retrieveByPKs($pks, PropelPDO $con = null)
    1756:     {
    1757:         if ($con === null) {
    1758:             $con = Propel::getConnection(FeatureProdPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1759:         }
    1760:
    1761:         $objs = null;
    1762:         if (empty($pks)) {
    1763:             $objs = array();
    1764:         } else {
    1765:             $criteria = new Criteria(FeatureProdPeer::DATABASE_NAME);
    1766:             $criteria->add(FeatureProdPeer::ID, $pks, Criteria::IN);
    1767:             $objs = FeatureProdPeer::doSelect($criteria, $con);
    1768:         }
    1769:
    1770:         return $objs;
    1771:     }
    1772:
    1773: } // BaseFeatureProdPeer
    1774:
    1775: // This is the static code needed to register the TableMap for this table with the main Propel class.
    1776: //
    1777: BaseFeatureProdPeer::buildTableMap();
    1778:
    1779: