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