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