Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
   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 durirectly (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()
 394:     {
 395:         RewritingPeer::$instances = array();
 396:     }
 397: 
 398:     /**
 399:      * Method to invalidate the instance pool of all tables related to rewriting
 400:      * by a foreign key with ON DELETE CASCADE
 401:      */
 402:     public static function clearRelatedInstancePool()
 403:     {
 404:     }
 405: 
 406:     /**
 407:      * 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.
 408:      *
 409:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 410:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 411:      *
 412:      * @param      array $row PropelPDO resultset row.
 413:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 414:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 415:      */
 416:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 417:     {
 418:         // If the PK cannot be derived from the row, return null.
 419:         if ($row[$startcol] === null) {
 420:             return null;
 421:         }
 422: 
 423:         return (string) $row[$startcol];
 424:     }
 425: 
 426:     /**
 427:      * Retrieves the primary key from the DB resultset row
 428:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 429:      * a multi-column primary key, an array of the primary key columns will be returned.
 430:      *
 431:      * @param      array $row PropelPDO resultset row.
 432:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 433:      * @return mixed The primary key of the row
 434:      */
 435:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 436:     {
 437: 
 438:         return (int) $row[$startcol];
 439:     }
 440: 
 441:     /**
 442:      * The returned array will contain objects of the default type or
 443:      * objects that inherit from the default.
 444:      *
 445:      * @throws PropelException Any exceptions caught during processing will be
 446:      *       rethrown wrapped into a PropelException.
 447:      */
 448:     public static function populateObjects(PDOStatement $stmt)
 449:     {
 450:         $results = array();
 451: 
 452:         // set the class once to avoid overhead in the loop
 453:         $cls = RewritingPeer::getOMClass();
 454:         // populate the object(s)
 455:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 456:             $key = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
 457:             if (null !== ($obj = RewritingPeer::getInstanceFromPool($key))) {
 458:                 // We no longer rehydrate the object, since this can cause data loss.
 459:                 // See http://www.propelorm.org/ticket/509
 460:                 // $obj->hydrate($row, 0, true); // rehydrate
 461:                 $results[] = $obj;
 462:             } else {
 463:                 $obj = new $cls();
 464:                 $obj->hydrate($row);
 465:                 $results[] = $obj;
 466:                 RewritingPeer::addInstanceToPool($obj, $key);
 467:             } // if key exists
 468:         }
 469:         $stmt->closeCursor();
 470: 
 471:         return $results;
 472:     }
 473:     /**
 474:      * Populates an object of the default type or an object that inherit from the default.
 475:      *
 476:      * @param      array $row PropelPDO resultset row.
 477:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 478:      * @throws PropelException Any exceptions caught during processing will be
 479:      *       rethrown wrapped into a PropelException.
 480:      * @return array (Rewriting object, last column rank)
 481:      */
 482:     public static function populateObject($row, $startcol = 0)
 483:     {
 484:         $key = RewritingPeer::getPrimaryKeyHashFromRow($row, $startcol);
 485:         if (null !== ($obj = RewritingPeer::getInstanceFromPool($key))) {
 486:             // We no longer rehydrate the object, since this can cause data loss.
 487:             // See http://www.propelorm.org/ticket/509
 488:             // $obj->hydrate($row, $startcol, true); // rehydrate
 489:             $col = $startcol + RewritingPeer::NUM_HYDRATE_COLUMNS;
 490:         } else {
 491:             $cls = RewritingPeer::OM_CLASS;
 492:             $obj = new $cls();
 493:             $col = $obj->hydrate($row, $startcol);
 494:             RewritingPeer::addInstanceToPool($obj, $key);
 495:         }
 496: 
 497:         return array($obj, $col);
 498:     }
 499: 
 500: 
 501:     /**
 502:      * Returns the number of rows matching criteria, joining the related Product table
 503:      *
 504:      * @param      Criteria $criteria
 505:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 506:      * @param      PropelPDO $con
 507:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 508:      * @return int Number of matching rows.
 509:      */
 510:     public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 511:     {
 512:         // we're going to modify criteria, so copy it first
 513:         $criteria = clone $criteria;
 514: 
 515:         // We need to set the primary table name, since in the case that there are no WHERE columns
 516:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 517:         // tables go into the FROM clause.
 518:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
 519: 
 520:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 521:             $criteria->setDistinct();
 522:         }
 523: 
 524:         if (!$criteria->hasSelectClause()) {
 525:             RewritingPeer::addSelectColumns($criteria);
 526:         }
 527: 
 528:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 529: 
 530:         // Set the correct dbName
 531:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 532: 
 533:         if ($con === null) {
 534:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 535:         }
 536: 
 537:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
 538: 
 539:         $stmt = BasePeer::doCount($criteria, $con);
 540: 
 541:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 542:             $count = (int) $row[0];
 543:         } else {
 544:             $count = 0; // no rows returned; we infer that means 0 matches.
 545:         }
 546:         $stmt->closeCursor();
 547: 
 548:         return $count;
 549:     }
 550: 
 551: 
 552:     /**
 553:      * Returns the number of rows matching criteria, joining the related Category table
 554:      *
 555:      * @param      Criteria $criteria
 556:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 557:      * @param      PropelPDO $con
 558:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 559:      * @return int Number of matching rows.
 560:      */
 561:     public static function doCountJoinCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 562:     {
 563:         // we're going to modify criteria, so copy it first
 564:         $criteria = clone $criteria;
 565: 
 566:         // We need to set the primary table name, since in the case that there are no WHERE columns
 567:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 568:         // tables go into the FROM clause.
 569:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
 570: 
 571:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 572:             $criteria->setDistinct();
 573:         }
 574: 
 575:         if (!$criteria->hasSelectClause()) {
 576:             RewritingPeer::addSelectColumns($criteria);
 577:         }
 578: 
 579:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 580: 
 581:         // Set the correct dbName
 582:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 583: 
 584:         if ($con === null) {
 585:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 586:         }
 587: 
 588:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
 589: 
 590:         $stmt = BasePeer::doCount($criteria, $con);
 591: 
 592:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 593:             $count = (int) $row[0];
 594:         } else {
 595:             $count = 0; // no rows returned; we infer that means 0 matches.
 596:         }
 597:         $stmt->closeCursor();
 598: 
 599:         return $count;
 600:     }
 601: 
 602: 
 603:     /**
 604:      * Returns the number of rows matching criteria, joining the related Folder table
 605:      *
 606:      * @param      Criteria $criteria
 607:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 608:      * @param      PropelPDO $con
 609:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 610:      * @return int Number of matching rows.
 611:      */
 612:     public static function doCountJoinFolder(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 613:     {
 614:         // we're going to modify criteria, so copy it first
 615:         $criteria = clone $criteria;
 616: 
 617:         // We need to set the primary table name, since in the case that there are no WHERE columns
 618:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 619:         // tables go into the FROM clause.
 620:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
 621: 
 622:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 623:             $criteria->setDistinct();
 624:         }
 625: 
 626:         if (!$criteria->hasSelectClause()) {
 627:             RewritingPeer::addSelectColumns($criteria);
 628:         }
 629: 
 630:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 631: 
 632:         // Set the correct dbName
 633:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 634: 
 635:         if ($con === null) {
 636:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 637:         }
 638: 
 639:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
 640: 
 641:         $stmt = BasePeer::doCount($criteria, $con);
 642: 
 643:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 644:             $count = (int) $row[0];
 645:         } else {
 646:             $count = 0; // no rows returned; we infer that means 0 matches.
 647:         }
 648:         $stmt->closeCursor();
 649: 
 650:         return $count;
 651:     }
 652: 
 653: 
 654:     /**
 655:      * Returns the number of rows matching criteria, joining the related Content table
 656:      *
 657:      * @param      Criteria $criteria
 658:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 659:      * @param      PropelPDO $con
 660:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 661:      * @return int Number of matching rows.
 662:      */
 663:     public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 664:     {
 665:         // we're going to modify criteria, so copy it first
 666:         $criteria = clone $criteria;
 667: 
 668:         // We need to set the primary table name, since in the case that there are no WHERE columns
 669:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 670:         // tables go into the FROM clause.
 671:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
 672: 
 673:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 674:             $criteria->setDistinct();
 675:         }
 676: 
 677:         if (!$criteria->hasSelectClause()) {
 678:             RewritingPeer::addSelectColumns($criteria);
 679:         }
 680: 
 681:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 682: 
 683:         // Set the correct dbName
 684:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 685: 
 686:         if ($con === null) {
 687:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 688:         }
 689: 
 690:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
 691: 
 692:         $stmt = BasePeer::doCount($criteria, $con);
 693: 
 694:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 695:             $count = (int) $row[0];
 696:         } else {
 697:             $count = 0; // no rows returned; we infer that means 0 matches.
 698:         }
 699:         $stmt->closeCursor();
 700: 
 701:         return $count;
 702:     }
 703: 
 704: 
 705:     /**
 706:      * Selects a collection of Rewriting objects pre-filled with their Product objects.
 707:      * @param      Criteria  $criteria
 708:      * @param      PropelPDO $con
 709:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 710:      * @return array           Array of Rewriting objects.
 711:      * @throws PropelException Any exceptions caught during processing will be
 712:      *       rethrown wrapped into a PropelException.
 713:      */
 714:     public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 715:     {
 716:         $criteria = clone $criteria;
 717: 
 718:         // Set the correct dbName if it has not been overridden
 719:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 720:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 721:         }
 722: 
 723:         RewritingPeer::addSelectColumns($criteria);
 724:         $startcol = RewritingPeer::NUM_HYDRATE_COLUMNS;
 725:         ProductPeer::addSelectColumns($criteria);
 726: 
 727:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
 728: 
 729:         $stmt = BasePeer::doSelect($criteria, $con);
 730:         $results = array();
 731: 
 732:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 733:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
 734:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
 735:                 // We no longer rehydrate the object, since this can cause data loss.
 736:                 // See http://www.propelorm.org/ticket/509
 737:                 // $obj1->hydrate($row, 0, true); // rehydrate
 738:             } else {
 739: 
 740:                 $cls = RewritingPeer::getOMClass();
 741: 
 742:                 $obj1 = new $cls();
 743:                 $obj1->hydrate($row);
 744:                 RewritingPeer::addInstanceToPool($obj1, $key1);
 745:             } // if $obj1 already loaded
 746: 
 747:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
 748:             if ($key2 !== null) {
 749:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
 750:                 if (!$obj2) {
 751: 
 752:                     $cls = ProductPeer::getOMClass();
 753: 
 754:                     $obj2 = new $cls();
 755:                     $obj2->hydrate($row, $startcol);
 756:                     ProductPeer::addInstanceToPool($obj2, $key2);
 757:                 } // if obj2 already loaded
 758: 
 759:                 // Add the $obj1 (Rewriting) to $obj2 (Product)
 760:                 $obj2->addRewriting($obj1);
 761: 
 762:             } // if joined row was not null
 763: 
 764:             $results[] = $obj1;
 765:         }
 766:         $stmt->closeCursor();
 767: 
 768:         return $results;
 769:     }
 770: 
 771: 
 772:     /**
 773:      * Selects a collection of Rewriting objects pre-filled with their Category objects.
 774:      * @param      Criteria  $criteria
 775:      * @param      PropelPDO $con
 776:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 777:      * @return array           Array of Rewriting objects.
 778:      * @throws PropelException Any exceptions caught during processing will be
 779:      *       rethrown wrapped into a PropelException.
 780:      */
 781:     public static function doSelectJoinCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 782:     {
 783:         $criteria = clone $criteria;
 784: 
 785:         // Set the correct dbName if it has not been overridden
 786:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 787:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 788:         }
 789: 
 790:         RewritingPeer::addSelectColumns($criteria);
 791:         $startcol = RewritingPeer::NUM_HYDRATE_COLUMNS;
 792:         CategoryPeer::addSelectColumns($criteria);
 793: 
 794:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
 795: 
 796:         $stmt = BasePeer::doSelect($criteria, $con);
 797:         $results = array();
 798: 
 799:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 800:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
 801:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
 802:                 // We no longer rehydrate the object, since this can cause data loss.
 803:                 // See http://www.propelorm.org/ticket/509
 804:                 // $obj1->hydrate($row, 0, true); // rehydrate
 805:             } else {
 806: 
 807:                 $cls = RewritingPeer::getOMClass();
 808: 
 809:                 $obj1 = new $cls();
 810:                 $obj1->hydrate($row);
 811:                 RewritingPeer::addInstanceToPool($obj1, $key1);
 812:             } // if $obj1 already loaded
 813: 
 814:             $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
 815:             if ($key2 !== null) {
 816:                 $obj2 = CategoryPeer::getInstanceFromPool($key2);
 817:                 if (!$obj2) {
 818: 
 819:                     $cls = CategoryPeer::getOMClass();
 820: 
 821:                     $obj2 = new $cls();
 822:                     $obj2->hydrate($row, $startcol);
 823:                     CategoryPeer::addInstanceToPool($obj2, $key2);
 824:                 } // if obj2 already loaded
 825: 
 826:                 // Add the $obj1 (Rewriting) to $obj2 (Category)
 827:                 $obj2->addRewriting($obj1);
 828: 
 829:             } // if joined row was not null
 830: 
 831:             $results[] = $obj1;
 832:         }
 833:         $stmt->closeCursor();
 834: 
 835:         return $results;
 836:     }
 837: 
 838: 
 839:     /**
 840:      * Selects a collection of Rewriting objects pre-filled with their Folder objects.
 841:      * @param      Criteria  $criteria
 842:      * @param      PropelPDO $con
 843:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 844:      * @return array           Array of Rewriting objects.
 845:      * @throws PropelException Any exceptions caught during processing will be
 846:      *       rethrown wrapped into a PropelException.
 847:      */
 848:     public static function doSelectJoinFolder(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 849:     {
 850:         $criteria = clone $criteria;
 851: 
 852:         // Set the correct dbName if it has not been overridden
 853:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 854:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 855:         }
 856: 
 857:         RewritingPeer::addSelectColumns($criteria);
 858:         $startcol = RewritingPeer::NUM_HYDRATE_COLUMNS;
 859:         FolderPeer::addSelectColumns($criteria);
 860: 
 861:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
 862: 
 863:         $stmt = BasePeer::doSelect($criteria, $con);
 864:         $results = array();
 865: 
 866:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 867:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
 868:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
 869:                 // We no longer rehydrate the object, since this can cause data loss.
 870:                 // See http://www.propelorm.org/ticket/509
 871:                 // $obj1->hydrate($row, 0, true); // rehydrate
 872:             } else {
 873: 
 874:                 $cls = RewritingPeer::getOMClass();
 875: 
 876:                 $obj1 = new $cls();
 877:                 $obj1->hydrate($row);
 878:                 RewritingPeer::addInstanceToPool($obj1, $key1);
 879:             } // if $obj1 already loaded
 880: 
 881:             $key2 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol);
 882:             if ($key2 !== null) {
 883:                 $obj2 = FolderPeer::getInstanceFromPool($key2);
 884:                 if (!$obj2) {
 885: 
 886:                     $cls = FolderPeer::getOMClass();
 887: 
 888:                     $obj2 = new $cls();
 889:                     $obj2->hydrate($row, $startcol);
 890:                     FolderPeer::addInstanceToPool($obj2, $key2);
 891:                 } // if obj2 already loaded
 892: 
 893:                 // Add the $obj1 (Rewriting) to $obj2 (Folder)
 894:                 $obj2->addRewriting($obj1);
 895: 
 896:             } // if joined row was not null
 897: 
 898:             $results[] = $obj1;
 899:         }
 900:         $stmt->closeCursor();
 901: 
 902:         return $results;
 903:     }
 904: 
 905: 
 906:     /**
 907:      * Selects a collection of Rewriting objects pre-filled with their Content objects.
 908:      * @param      Criteria  $criteria
 909:      * @param      PropelPDO $con
 910:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 911:      * @return array           Array of Rewriting objects.
 912:      * @throws PropelException Any exceptions caught during processing will be
 913:      *       rethrown wrapped into a PropelException.
 914:      */
 915:     public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 916:     {
 917:         $criteria = clone $criteria;
 918: 
 919:         // Set the correct dbName if it has not been overridden
 920:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 921:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
 922:         }
 923: 
 924:         RewritingPeer::addSelectColumns($criteria);
 925:         $startcol = RewritingPeer::NUM_HYDRATE_COLUMNS;
 926:         ContentPeer::addSelectColumns($criteria);
 927: 
 928:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
 929: 
 930:         $stmt = BasePeer::doSelect($criteria, $con);
 931:         $results = array();
 932: 
 933:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 934:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
 935:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
 936:                 // We no longer rehydrate the object, since this can cause data loss.
 937:                 // See http://www.propelorm.org/ticket/509
 938:                 // $obj1->hydrate($row, 0, true); // rehydrate
 939:             } else {
 940: 
 941:                 $cls = RewritingPeer::getOMClass();
 942: 
 943:                 $obj1 = new $cls();
 944:                 $obj1->hydrate($row);
 945:                 RewritingPeer::addInstanceToPool($obj1, $key1);
 946:             } // if $obj1 already loaded
 947: 
 948:             $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
 949:             if ($key2 !== null) {
 950:                 $obj2 = ContentPeer::getInstanceFromPool($key2);
 951:                 if (!$obj2) {
 952: 
 953:                     $cls = ContentPeer::getOMClass();
 954: 
 955:                     $obj2 = new $cls();
 956:                     $obj2->hydrate($row, $startcol);
 957:                     ContentPeer::addInstanceToPool($obj2, $key2);
 958:                 } // if obj2 already loaded
 959: 
 960:                 // Add the $obj1 (Rewriting) to $obj2 (Content)
 961:                 $obj2->addRewriting($obj1);
 962: 
 963:             } // if joined row was not null
 964: 
 965:             $results[] = $obj1;
 966:         }
 967:         $stmt->closeCursor();
 968: 
 969:         return $results;
 970:     }
 971: 
 972: 
 973:     /**
 974:      * Returns the number of rows matching criteria, joining all related tables
 975:      *
 976:      * @param      Criteria $criteria
 977:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 978:      * @param      PropelPDO $con
 979:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 980:      * @return int Number of matching rows.
 981:      */
 982:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 983:     {
 984:         // we're going to modify criteria, so copy it first
 985:         $criteria = clone $criteria;
 986: 
 987:         // We need to set the primary table name, since in the case that there are no WHERE columns
 988:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 989:         // tables go into the FROM clause.
 990:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
 991: 
 992:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 993:             $criteria->setDistinct();
 994:         }
 995: 
 996:         if (!$criteria->hasSelectClause()) {
 997:             RewritingPeer::addSelectColumns($criteria);
 998:         }
 999: 
1000:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
1001: 
1002:         // Set the correct dbName
1003:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1004: 
1005:         if ($con === null) {
1006:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1007:         }
1008: 
1009:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1010: 
1011:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1012: 
1013:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1014: 
1015:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1016: 
1017:         $stmt = BasePeer::doCount($criteria, $con);
1018: 
1019:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1020:             $count = (int) $row[0];
1021:         } else {
1022:             $count = 0; // no rows returned; we infer that means 0 matches.
1023:         }
1024:         $stmt->closeCursor();
1025: 
1026:         return $count;
1027:     }
1028: 
1029:     /**
1030:      * Selects a collection of Rewriting objects pre-filled with all related objects.
1031:      *
1032:      * @param      Criteria  $criteria
1033:      * @param      PropelPDO $con
1034:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1035:      * @return array           Array of Rewriting objects.
1036:      * @throws PropelException Any exceptions caught during processing will be
1037:      *       rethrown wrapped into a PropelException.
1038:      */
1039:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1040:     {
1041:         $criteria = clone $criteria;
1042: 
1043:         // Set the correct dbName if it has not been overridden
1044:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1045:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1046:         }
1047: 
1048:         RewritingPeer::addSelectColumns($criteria);
1049:         $startcol2 = RewritingPeer::NUM_HYDRATE_COLUMNS;
1050: 
1051:         ProductPeer::addSelectColumns($criteria);
1052:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1053: 
1054:         CategoryPeer::addSelectColumns($criteria);
1055:         $startcol4 = $startcol3 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1056: 
1057:         FolderPeer::addSelectColumns($criteria);
1058:         $startcol5 = $startcol4 + FolderPeer::NUM_HYDRATE_COLUMNS;
1059: 
1060:         ContentPeer::addSelectColumns($criteria);
1061:         $startcol6 = $startcol5 + ContentPeer::NUM_HYDRATE_COLUMNS;
1062: 
1063:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1064: 
1065:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1066: 
1067:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1068: 
1069:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1070: 
1071:         $stmt = BasePeer::doSelect($criteria, $con);
1072:         $results = array();
1073: 
1074:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1075:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
1076:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
1077:                 // We no longer rehydrate the object, since this can cause data loss.
1078:                 // See http://www.propelorm.org/ticket/509
1079:                 // $obj1->hydrate($row, 0, true); // rehydrate
1080:             } else {
1081:                 $cls = RewritingPeer::getOMClass();
1082: 
1083:                 $obj1 = new $cls();
1084:                 $obj1->hydrate($row);
1085:                 RewritingPeer::addInstanceToPool($obj1, $key1);
1086:             } // if obj1 already loaded
1087: 
1088:             // Add objects for joined Product rows
1089: 
1090:             $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1091:             if ($key2 !== null) {
1092:                 $obj2 = ProductPeer::getInstanceFromPool($key2);
1093:                 if (!$obj2) {
1094: 
1095:                     $cls = ProductPeer::getOMClass();
1096: 
1097:                     $obj2 = new $cls();
1098:                     $obj2->hydrate($row, $startcol2);
1099:                     ProductPeer::addInstanceToPool($obj2, $key2);
1100:                 } // if obj2 loaded
1101: 
1102:                 // Add the $obj1 (Rewriting) to the collection in $obj2 (Product)
1103:                 $obj2->addRewriting($obj1);
1104:             } // if joined row not null
1105: 
1106:             // Add objects for joined Category rows
1107: 
1108:             $key3 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1109:             if ($key3 !== null) {
1110:                 $obj3 = CategoryPeer::getInstanceFromPool($key3);
1111:                 if (!$obj3) {
1112: 
1113:                     $cls = CategoryPeer::getOMClass();
1114: 
1115:                     $obj3 = new $cls();
1116:                     $obj3->hydrate($row, $startcol3);
1117:                     CategoryPeer::addInstanceToPool($obj3, $key3);
1118:                 } // if obj3 loaded
1119: 
1120:                 // Add the $obj1 (Rewriting) to the collection in $obj3 (Category)
1121:                 $obj3->addRewriting($obj1);
1122:             } // if joined row not null
1123: 
1124:             // Add objects for joined Folder rows
1125: 
1126:             $key4 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1127:             if ($key4 !== null) {
1128:                 $obj4 = FolderPeer::getInstanceFromPool($key4);
1129:                 if (!$obj4) {
1130: 
1131:                     $cls = FolderPeer::getOMClass();
1132: 
1133:                     $obj4 = new $cls();
1134:                     $obj4->hydrate($row, $startcol4);
1135:                     FolderPeer::addInstanceToPool($obj4, $key4);
1136:                 } // if obj4 loaded
1137: 
1138:                 // Add the $obj1 (Rewriting) to the collection in $obj4 (Folder)
1139:                 $obj4->addRewriting($obj1);
1140:             } // if joined row not null
1141: 
1142:             // Add objects for joined Content rows
1143: 
1144:             $key5 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol5);
1145:             if ($key5 !== null) {
1146:                 $obj5 = ContentPeer::getInstanceFromPool($key5);
1147:                 if (!$obj5) {
1148: 
1149:                     $cls = ContentPeer::getOMClass();
1150: 
1151:                     $obj5 = new $cls();
1152:                     $obj5->hydrate($row, $startcol5);
1153:                     ContentPeer::addInstanceToPool($obj5, $key5);
1154:                 } // if obj5 loaded
1155: 
1156:                 // Add the $obj1 (Rewriting) to the collection in $obj5 (Content)
1157:                 $obj5->addRewriting($obj1);
1158:             } // if joined row not null
1159: 
1160:             $results[] = $obj1;
1161:         }
1162:         $stmt->closeCursor();
1163: 
1164:         return $results;
1165:     }
1166: 
1167: 
1168:     /**
1169:      * Returns the number of rows matching criteria, joining the related Product table
1170:      *
1171:      * @param      Criteria $criteria
1172:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1173:      * @param      PropelPDO $con
1174:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1175:      * @return int Number of matching rows.
1176:      */
1177:     public static function doCountJoinAllExceptProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1178:     {
1179:         // we're going to modify criteria, so copy it first
1180:         $criteria = clone $criteria;
1181: 
1182:         // We need to set the primary table name, since in the case that there are no WHERE columns
1183:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1184:         // tables go into the FROM clause.
1185:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
1186: 
1187:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1188:             $criteria->setDistinct();
1189:         }
1190: 
1191:         if (!$criteria->hasSelectClause()) {
1192:             RewritingPeer::addSelectColumns($criteria);
1193:         }
1194: 
1195:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1196: 
1197:         // Set the correct dbName
1198:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1199: 
1200:         if ($con === null) {
1201:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1202:         }
1203: 
1204:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1205: 
1206:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1207: 
1208:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1209: 
1210:         $stmt = BasePeer::doCount($criteria, $con);
1211: 
1212:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1213:             $count = (int) $row[0];
1214:         } else {
1215:             $count = 0; // no rows returned; we infer that means 0 matches.
1216:         }
1217:         $stmt->closeCursor();
1218: 
1219:         return $count;
1220:     }
1221: 
1222: 
1223:     /**
1224:      * Returns the number of rows matching criteria, joining the related Category table
1225:      *
1226:      * @param      Criteria $criteria
1227:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1228:      * @param      PropelPDO $con
1229:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1230:      * @return int Number of matching rows.
1231:      */
1232:     public static function doCountJoinAllExceptCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1233:     {
1234:         // we're going to modify criteria, so copy it first
1235:         $criteria = clone $criteria;
1236: 
1237:         // We need to set the primary table name, since in the case that there are no WHERE columns
1238:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1239:         // tables go into the FROM clause.
1240:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
1241: 
1242:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1243:             $criteria->setDistinct();
1244:         }
1245: 
1246:         if (!$criteria->hasSelectClause()) {
1247:             RewritingPeer::addSelectColumns($criteria);
1248:         }
1249: 
1250:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1251: 
1252:         // Set the correct dbName
1253:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1254: 
1255:         if ($con === null) {
1256:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1257:         }
1258: 
1259:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1260: 
1261:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1262: 
1263:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1264: 
1265:         $stmt = BasePeer::doCount($criteria, $con);
1266: 
1267:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1268:             $count = (int) $row[0];
1269:         } else {
1270:             $count = 0; // no rows returned; we infer that means 0 matches.
1271:         }
1272:         $stmt->closeCursor();
1273: 
1274:         return $count;
1275:     }
1276: 
1277: 
1278:     /**
1279:      * Returns the number of rows matching criteria, joining the related Folder table
1280:      *
1281:      * @param      Criteria $criteria
1282:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1283:      * @param      PropelPDO $con
1284:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1285:      * @return int Number of matching rows.
1286:      */
1287:     public static function doCountJoinAllExceptFolder(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1288:     {
1289:         // we're going to modify criteria, so copy it first
1290:         $criteria = clone $criteria;
1291: 
1292:         // We need to set the primary table name, since in the case that there are no WHERE columns
1293:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1294:         // tables go into the FROM clause.
1295:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
1296: 
1297:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1298:             $criteria->setDistinct();
1299:         }
1300: 
1301:         if (!$criteria->hasSelectClause()) {
1302:             RewritingPeer::addSelectColumns($criteria);
1303:         }
1304: 
1305:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1306: 
1307:         // Set the correct dbName
1308:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1309: 
1310:         if ($con === null) {
1311:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1312:         }
1313: 
1314:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1315: 
1316:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1317: 
1318:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1319: 
1320:         $stmt = BasePeer::doCount($criteria, $con);
1321: 
1322:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1323:             $count = (int) $row[0];
1324:         } else {
1325:             $count = 0; // no rows returned; we infer that means 0 matches.
1326:         }
1327:         $stmt->closeCursor();
1328: 
1329:         return $count;
1330:     }
1331: 
1332: 
1333:     /**
1334:      * Returns the number of rows matching criteria, joining the related Content table
1335:      *
1336:      * @param      Criteria $criteria
1337:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1338:      * @param      PropelPDO $con
1339:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1340:      * @return int Number of matching rows.
1341:      */
1342:     public static function doCountJoinAllExceptContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1343:     {
1344:         // we're going to modify criteria, so copy it first
1345:         $criteria = clone $criteria;
1346: 
1347:         // We need to set the primary table name, since in the case that there are no WHERE columns
1348:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1349:         // tables go into the FROM clause.
1350:         $criteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
1351: 
1352:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1353:             $criteria->setDistinct();
1354:         }
1355: 
1356:         if (!$criteria->hasSelectClause()) {
1357:             RewritingPeer::addSelectColumns($criteria);
1358:         }
1359: 
1360:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1361: 
1362:         // Set the correct dbName
1363:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1364: 
1365:         if ($con === null) {
1366:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1367:         }
1368: 
1369:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1370: 
1371:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1372: 
1373:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1374: 
1375:         $stmt = BasePeer::doCount($criteria, $con);
1376: 
1377:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1378:             $count = (int) $row[0];
1379:         } else {
1380:             $count = 0; // no rows returned; we infer that means 0 matches.
1381:         }
1382:         $stmt->closeCursor();
1383: 
1384:         return $count;
1385:     }
1386: 
1387: 
1388:     /**
1389:      * Selects a collection of Rewriting objects pre-filled with all related objects except Product.
1390:      *
1391:      * @param      Criteria  $criteria
1392:      * @param      PropelPDO $con
1393:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1394:      * @return array           Array of Rewriting objects.
1395:      * @throws PropelException Any exceptions caught during processing will be
1396:      *       rethrown wrapped into a PropelException.
1397:      */
1398:     public static function doSelectJoinAllExceptProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1399:     {
1400:         $criteria = clone $criteria;
1401: 
1402:         // Set the correct dbName if it has not been overridden
1403:         // $criteria->getDbName() will return the same object if not set to another value
1404:         // so == check is okay and faster
1405:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1406:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1407:         }
1408: 
1409:         RewritingPeer::addSelectColumns($criteria);
1410:         $startcol2 = RewritingPeer::NUM_HYDRATE_COLUMNS;
1411: 
1412:         CategoryPeer::addSelectColumns($criteria);
1413:         $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1414: 
1415:         FolderPeer::addSelectColumns($criteria);
1416:         $startcol4 = $startcol3 + FolderPeer::NUM_HYDRATE_COLUMNS;
1417: 
1418:         ContentPeer::addSelectColumns($criteria);
1419:         $startcol5 = $startcol4 + ContentPeer::NUM_HYDRATE_COLUMNS;
1420: 
1421:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1422: 
1423:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1424: 
1425:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1426: 
1427: 
1428:         $stmt = BasePeer::doSelect($criteria, $con);
1429:         $results = array();
1430: 
1431:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1432:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
1433:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
1434:                 // We no longer rehydrate the object, since this can cause data loss.
1435:                 // See http://www.propelorm.org/ticket/509
1436:                 // $obj1->hydrate($row, 0, true); // rehydrate
1437:             } else {
1438:                 $cls = RewritingPeer::getOMClass();
1439: 
1440:                 $obj1 = new $cls();
1441:                 $obj1->hydrate($row);
1442:                 RewritingPeer::addInstanceToPool($obj1, $key1);
1443:             } // if obj1 already loaded
1444: 
1445:                 // Add objects for joined Category rows
1446: 
1447:                 $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1448:                 if ($key2 !== null) {
1449:                     $obj2 = CategoryPeer::getInstanceFromPool($key2);
1450:                     if (!$obj2) {
1451: 
1452:                         $cls = CategoryPeer::getOMClass();
1453: 
1454:                     $obj2 = new $cls();
1455:                     $obj2->hydrate($row, $startcol2);
1456:                     CategoryPeer::addInstanceToPool($obj2, $key2);
1457:                 } // if $obj2 already loaded
1458: 
1459:                 // Add the $obj1 (Rewriting) to the collection in $obj2 (Category)
1460:                 $obj2->addRewriting($obj1);
1461: 
1462:             } // if joined row is not null
1463: 
1464:                 // Add objects for joined Folder rows
1465: 
1466:                 $key3 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1467:                 if ($key3 !== null) {
1468:                     $obj3 = FolderPeer::getInstanceFromPool($key3);
1469:                     if (!$obj3) {
1470: 
1471:                         $cls = FolderPeer::getOMClass();
1472: 
1473:                     $obj3 = new $cls();
1474:                     $obj3->hydrate($row, $startcol3);
1475:                     FolderPeer::addInstanceToPool($obj3, $key3);
1476:                 } // if $obj3 already loaded
1477: 
1478:                 // Add the $obj1 (Rewriting) to the collection in $obj3 (Folder)
1479:                 $obj3->addRewriting($obj1);
1480: 
1481:             } // if joined row is not null
1482: 
1483:                 // Add objects for joined Content rows
1484: 
1485:                 $key4 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1486:                 if ($key4 !== null) {
1487:                     $obj4 = ContentPeer::getInstanceFromPool($key4);
1488:                     if (!$obj4) {
1489: 
1490:                         $cls = ContentPeer::getOMClass();
1491: 
1492:                     $obj4 = new $cls();
1493:                     $obj4->hydrate($row, $startcol4);
1494:                     ContentPeer::addInstanceToPool($obj4, $key4);
1495:                 } // if $obj4 already loaded
1496: 
1497:                 // Add the $obj1 (Rewriting) to the collection in $obj4 (Content)
1498:                 $obj4->addRewriting($obj1);
1499: 
1500:             } // if joined row is not null
1501: 
1502:             $results[] = $obj1;
1503:         }
1504:         $stmt->closeCursor();
1505: 
1506:         return $results;
1507:     }
1508: 
1509: 
1510:     /**
1511:      * Selects a collection of Rewriting objects pre-filled with all related objects except Category.
1512:      *
1513:      * @param      Criteria  $criteria
1514:      * @param      PropelPDO $con
1515:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1516:      * @return array           Array of Rewriting objects.
1517:      * @throws PropelException Any exceptions caught during processing will be
1518:      *       rethrown wrapped into a PropelException.
1519:      */
1520:     public static function doSelectJoinAllExceptCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1521:     {
1522:         $criteria = clone $criteria;
1523: 
1524:         // Set the correct dbName if it has not been overridden
1525:         // $criteria->getDbName() will return the same object if not set to another value
1526:         // so == check is okay and faster
1527:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1528:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1529:         }
1530: 
1531:         RewritingPeer::addSelectColumns($criteria);
1532:         $startcol2 = RewritingPeer::NUM_HYDRATE_COLUMNS;
1533: 
1534:         ProductPeer::addSelectColumns($criteria);
1535:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1536: 
1537:         FolderPeer::addSelectColumns($criteria);
1538:         $startcol4 = $startcol3 + FolderPeer::NUM_HYDRATE_COLUMNS;
1539: 
1540:         ContentPeer::addSelectColumns($criteria);
1541:         $startcol5 = $startcol4 + ContentPeer::NUM_HYDRATE_COLUMNS;
1542: 
1543:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1544: 
1545:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1546: 
1547:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1548: 
1549: 
1550:         $stmt = BasePeer::doSelect($criteria, $con);
1551:         $results = array();
1552: 
1553:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1554:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
1555:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
1556:                 // We no longer rehydrate the object, since this can cause data loss.
1557:                 // See http://www.propelorm.org/ticket/509
1558:                 // $obj1->hydrate($row, 0, true); // rehydrate
1559:             } else {
1560:                 $cls = RewritingPeer::getOMClass();
1561: 
1562:                 $obj1 = new $cls();
1563:                 $obj1->hydrate($row);
1564:                 RewritingPeer::addInstanceToPool($obj1, $key1);
1565:             } // if obj1 already loaded
1566: 
1567:                 // Add objects for joined Product rows
1568: 
1569:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1570:                 if ($key2 !== null) {
1571:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
1572:                     if (!$obj2) {
1573: 
1574:                         $cls = ProductPeer::getOMClass();
1575: 
1576:                     $obj2 = new $cls();
1577:                     $obj2->hydrate($row, $startcol2);
1578:                     ProductPeer::addInstanceToPool($obj2, $key2);
1579:                 } // if $obj2 already loaded
1580: 
1581:                 // Add the $obj1 (Rewriting) to the collection in $obj2 (Product)
1582:                 $obj2->addRewriting($obj1);
1583: 
1584:             } // if joined row is not null
1585: 
1586:                 // Add objects for joined Folder rows
1587: 
1588:                 $key3 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1589:                 if ($key3 !== null) {
1590:                     $obj3 = FolderPeer::getInstanceFromPool($key3);
1591:                     if (!$obj3) {
1592: 
1593:                         $cls = FolderPeer::getOMClass();
1594: 
1595:                     $obj3 = new $cls();
1596:                     $obj3->hydrate($row, $startcol3);
1597:                     FolderPeer::addInstanceToPool($obj3, $key3);
1598:                 } // if $obj3 already loaded
1599: 
1600:                 // Add the $obj1 (Rewriting) to the collection in $obj3 (Folder)
1601:                 $obj3->addRewriting($obj1);
1602: 
1603:             } // if joined row is not null
1604: 
1605:                 // Add objects for joined Content rows
1606: 
1607:                 $key4 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1608:                 if ($key4 !== null) {
1609:                     $obj4 = ContentPeer::getInstanceFromPool($key4);
1610:                     if (!$obj4) {
1611: 
1612:                         $cls = ContentPeer::getOMClass();
1613: 
1614:                     $obj4 = new $cls();
1615:                     $obj4->hydrate($row, $startcol4);
1616:                     ContentPeer::addInstanceToPool($obj4, $key4);
1617:                 } // if $obj4 already loaded
1618: 
1619:                 // Add the $obj1 (Rewriting) to the collection in $obj4 (Content)
1620:                 $obj4->addRewriting($obj1);
1621: 
1622:             } // if joined row is not null
1623: 
1624:             $results[] = $obj1;
1625:         }
1626:         $stmt->closeCursor();
1627: 
1628:         return $results;
1629:     }
1630: 
1631: 
1632:     /**
1633:      * Selects a collection of Rewriting objects pre-filled with all related objects except Folder.
1634:      *
1635:      * @param      Criteria  $criteria
1636:      * @param      PropelPDO $con
1637:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1638:      * @return array           Array of Rewriting objects.
1639:      * @throws PropelException Any exceptions caught during processing will be
1640:      *       rethrown wrapped into a PropelException.
1641:      */
1642:     public static function doSelectJoinAllExceptFolder(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1643:     {
1644:         $criteria = clone $criteria;
1645: 
1646:         // Set the correct dbName if it has not been overridden
1647:         // $criteria->getDbName() will return the same object if not set to another value
1648:         // so == check is okay and faster
1649:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1650:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1651:         }
1652: 
1653:         RewritingPeer::addSelectColumns($criteria);
1654:         $startcol2 = RewritingPeer::NUM_HYDRATE_COLUMNS;
1655: 
1656:         ProductPeer::addSelectColumns($criteria);
1657:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1658: 
1659:         CategoryPeer::addSelectColumns($criteria);
1660:         $startcol4 = $startcol3 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1661: 
1662:         ContentPeer::addSelectColumns($criteria);
1663:         $startcol5 = $startcol4 + ContentPeer::NUM_HYDRATE_COLUMNS;
1664: 
1665:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1666: 
1667:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1668: 
1669:         $criteria->addJoin(RewritingPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1670: 
1671: 
1672:         $stmt = BasePeer::doSelect($criteria, $con);
1673:         $results = array();
1674: 
1675:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1676:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
1677:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
1678:                 // We no longer rehydrate the object, since this can cause data loss.
1679:                 // See http://www.propelorm.org/ticket/509
1680:                 // $obj1->hydrate($row, 0, true); // rehydrate
1681:             } else {
1682:                 $cls = RewritingPeer::getOMClass();
1683: 
1684:                 $obj1 = new $cls();
1685:                 $obj1->hydrate($row);
1686:                 RewritingPeer::addInstanceToPool($obj1, $key1);
1687:             } // if obj1 already loaded
1688: 
1689:                 // Add objects for joined Product rows
1690: 
1691:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1692:                 if ($key2 !== null) {
1693:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
1694:                     if (!$obj2) {
1695: 
1696:                         $cls = ProductPeer::getOMClass();
1697: 
1698:                     $obj2 = new $cls();
1699:                     $obj2->hydrate($row, $startcol2);
1700:                     ProductPeer::addInstanceToPool($obj2, $key2);
1701:                 } // if $obj2 already loaded
1702: 
1703:                 // Add the $obj1 (Rewriting) to the collection in $obj2 (Product)
1704:                 $obj2->addRewriting($obj1);
1705: 
1706:             } // if joined row is not null
1707: 
1708:                 // Add objects for joined Category rows
1709: 
1710:                 $key3 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1711:                 if ($key3 !== null) {
1712:                     $obj3 = CategoryPeer::getInstanceFromPool($key3);
1713:                     if (!$obj3) {
1714: 
1715:                         $cls = CategoryPeer::getOMClass();
1716: 
1717:                     $obj3 = new $cls();
1718:                     $obj3->hydrate($row, $startcol3);
1719:                     CategoryPeer::addInstanceToPool($obj3, $key3);
1720:                 } // if $obj3 already loaded
1721: 
1722:                 // Add the $obj1 (Rewriting) to the collection in $obj3 (Category)
1723:                 $obj3->addRewriting($obj1);
1724: 
1725:             } // if joined row is not null
1726: 
1727:                 // Add objects for joined Content rows
1728: 
1729:                 $key4 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1730:                 if ($key4 !== null) {
1731:                     $obj4 = ContentPeer::getInstanceFromPool($key4);
1732:                     if (!$obj4) {
1733: 
1734:                         $cls = ContentPeer::getOMClass();
1735: 
1736:                     $obj4 = new $cls();
1737:                     $obj4->hydrate($row, $startcol4);
1738:                     ContentPeer::addInstanceToPool($obj4, $key4);
1739:                 } // if $obj4 already loaded
1740: 
1741:                 // Add the $obj1 (Rewriting) to the collection in $obj4 (Content)
1742:                 $obj4->addRewriting($obj1);
1743: 
1744:             } // if joined row is not null
1745: 
1746:             $results[] = $obj1;
1747:         }
1748:         $stmt->closeCursor();
1749: 
1750:         return $results;
1751:     }
1752: 
1753: 
1754:     /**
1755:      * Selects a collection of Rewriting objects pre-filled with all related objects except Content.
1756:      *
1757:      * @param      Criteria  $criteria
1758:      * @param      PropelPDO $con
1759:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1760:      * @return array           Array of Rewriting objects.
1761:      * @throws PropelException Any exceptions caught during processing will be
1762:      *       rethrown wrapped into a PropelException.
1763:      */
1764:     public static function doSelectJoinAllExceptContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1765:     {
1766:         $criteria = clone $criteria;
1767: 
1768:         // Set the correct dbName if it has not been overridden
1769:         // $criteria->getDbName() will return the same object if not set to another value
1770:         // so == check is okay and faster
1771:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1772:             $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1773:         }
1774: 
1775:         RewritingPeer::addSelectColumns($criteria);
1776:         $startcol2 = RewritingPeer::NUM_HYDRATE_COLUMNS;
1777: 
1778:         ProductPeer::addSelectColumns($criteria);
1779:         $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1780: 
1781:         CategoryPeer::addSelectColumns($criteria);
1782:         $startcol4 = $startcol3 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1783: 
1784:         FolderPeer::addSelectColumns($criteria);
1785:         $startcol5 = $startcol4 + FolderPeer::NUM_HYDRATE_COLUMNS;
1786: 
1787:         $criteria->addJoin(RewritingPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1788: 
1789:         $criteria->addJoin(RewritingPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1790: 
1791:         $criteria->addJoin(RewritingPeer::FOLDER_ID, FolderPeer::ID, $join_behavior);
1792: 
1793: 
1794:         $stmt = BasePeer::doSelect($criteria, $con);
1795:         $results = array();
1796: 
1797:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1798:             $key1 = RewritingPeer::getPrimaryKeyHashFromRow($row, 0);
1799:             if (null !== ($obj1 = RewritingPeer::getInstanceFromPool($key1))) {
1800:                 // We no longer rehydrate the object, since this can cause data loss.
1801:                 // See http://www.propelorm.org/ticket/509
1802:                 // $obj1->hydrate($row, 0, true); // rehydrate
1803:             } else {
1804:                 $cls = RewritingPeer::getOMClass();
1805: 
1806:                 $obj1 = new $cls();
1807:                 $obj1->hydrate($row);
1808:                 RewritingPeer::addInstanceToPool($obj1, $key1);
1809:             } // if obj1 already loaded
1810: 
1811:                 // Add objects for joined Product rows
1812: 
1813:                 $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1814:                 if ($key2 !== null) {
1815:                     $obj2 = ProductPeer::getInstanceFromPool($key2);
1816:                     if (!$obj2) {
1817: 
1818:                         $cls = ProductPeer::getOMClass();
1819: 
1820:                     $obj2 = new $cls();
1821:                     $obj2->hydrate($row, $startcol2);
1822:                     ProductPeer::addInstanceToPool($obj2, $key2);
1823:                 } // if $obj2 already loaded
1824: 
1825:                 // Add the $obj1 (Rewriting) to the collection in $obj2 (Product)
1826:                 $obj2->addRewriting($obj1);
1827: 
1828:             } // if joined row is not null
1829: 
1830:                 // Add objects for joined Category rows
1831: 
1832:                 $key3 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1833:                 if ($key3 !== null) {
1834:                     $obj3 = CategoryPeer::getInstanceFromPool($key3);
1835:                     if (!$obj3) {
1836: 
1837:                         $cls = CategoryPeer::getOMClass();
1838: 
1839:                     $obj3 = new $cls();
1840:                     $obj3->hydrate($row, $startcol3);
1841:                     CategoryPeer::addInstanceToPool($obj3, $key3);
1842:                 } // if $obj3 already loaded
1843: 
1844:                 // Add the $obj1 (Rewriting) to the collection in $obj3 (Category)
1845:                 $obj3->addRewriting($obj1);
1846: 
1847:             } // if joined row is not null
1848: 
1849:                 // Add objects for joined Folder rows
1850: 
1851:                 $key4 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1852:                 if ($key4 !== null) {
1853:                     $obj4 = FolderPeer::getInstanceFromPool($key4);
1854:                     if (!$obj4) {
1855: 
1856:                         $cls = FolderPeer::getOMClass();
1857: 
1858:                     $obj4 = new $cls();
1859:                     $obj4->hydrate($row, $startcol4);
1860:                     FolderPeer::addInstanceToPool($obj4, $key4);
1861:                 } // if $obj4 already loaded
1862: 
1863:                 // Add the $obj1 (Rewriting) to the collection in $obj4 (Folder)
1864:                 $obj4->addRewriting($obj1);
1865: 
1866:             } // if joined row is not null
1867: 
1868:             $results[] = $obj1;
1869:         }
1870:         $stmt->closeCursor();
1871: 
1872:         return $results;
1873:     }
1874: 
1875:     /**
1876:      * Returns the TableMap related to this peer.
1877:      * This method is not needed for general use but a specific application could have a need.
1878:      * @return TableMap
1879:      * @throws PropelException Any exceptions caught during processing will be
1880:      *       rethrown wrapped into a PropelException.
1881:      */
1882:     public static function getTableMap()
1883:     {
1884:         return Propel::getDatabaseMap(RewritingPeer::DATABASE_NAME)->getTable(RewritingPeer::TABLE_NAME);
1885:     }
1886: 
1887:     /**
1888:      * Add a TableMap instance to the database for this peer class.
1889:      */
1890:     public static function buildTableMap()
1891:     {
1892:       $dbMap = Propel::getDatabaseMap(BaseRewritingPeer::DATABASE_NAME);
1893:       if (!$dbMap->hasTable(BaseRewritingPeer::TABLE_NAME)) {
1894:         $dbMap->addTableObject(new RewritingTableMap());
1895:       }
1896:     }
1897: 
1898:     /**
1899:      * The class that the Peer will make instances of.
1900:      *
1901:      *
1902:      * @return string ClassName
1903:      */
1904:     public static function getOMClass()
1905:     {
1906:         return RewritingPeer::OM_CLASS;
1907:     }
1908: 
1909:     /**
1910:      * Performs an INSERT on the database, given a Rewriting or Criteria object.
1911:      *
1912:      * @param      mixed $values Criteria or Rewriting object containing data that is used to create the INSERT statement.
1913:      * @param      PropelPDO $con the PropelPDO connection to use
1914:      * @return mixed           The new primary key.
1915:      * @throws PropelException Any exceptions caught during processing will be
1916:      *       rethrown wrapped into a PropelException.
1917:      */
1918:     public static function doInsert($values, PropelPDO $con = null)
1919:     {
1920:         if ($con === null) {
1921:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1922:         }
1923: 
1924:         if ($values instanceof Criteria) {
1925:             $criteria = clone $values; // rename for clarity
1926:         } else {
1927:             $criteria = $values->buildCriteria(); // build Criteria from Rewriting object
1928:         }
1929: 
1930: 
1931:         // Set the correct dbName
1932:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1933: 
1934:         try {
1935:             // use transaction because $criteria could contain info
1936:             // for more than one table (I guess, conceivably)
1937:             $con->beginTransaction();
1938:             $pk = BasePeer::doInsert($criteria, $con);
1939:             $con->commit();
1940:         } catch (PropelException $e) {
1941:             $con->rollBack();
1942:             throw $e;
1943:         }
1944: 
1945:         return $pk;
1946:     }
1947: 
1948:     /**
1949:      * Performs an UPDATE on the database, given a Rewriting or Criteria object.
1950:      *
1951:      * @param      mixed $values Criteria or Rewriting object containing data that is used to create the UPDATE statement.
1952:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
1953:      * @return int             The number of affected rows (if supported by underlying database driver).
1954:      * @throws PropelException Any exceptions caught during processing will be
1955:      *       rethrown wrapped into a PropelException.
1956:      */
1957:     public static function doUpdate($values, PropelPDO $con = null)
1958:     {
1959:         if ($con === null) {
1960:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1961:         }
1962: 
1963:         $selectCriteria = new Criteria(RewritingPeer::DATABASE_NAME);
1964: 
1965:         if ($values instanceof Criteria) {
1966:             $criteria = clone $values; // rename for clarity
1967: 
1968:             $comparison = $criteria->getComparison(RewritingPeer::ID);
1969:             $value = $criteria->remove(RewritingPeer::ID);
1970:             if ($value) {
1971:                 $selectCriteria->add(RewritingPeer::ID, $value, $comparison);
1972:             } else {
1973:                 $selectCriteria->setPrimaryTableName(RewritingPeer::TABLE_NAME);
1974:             }
1975: 
1976:         } else { // $values is Rewriting object
1977:             $criteria = $values->buildCriteria(); // gets full criteria
1978:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
1979:         }
1980: 
1981:         // set the correct dbName
1982:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
1983: 
1984:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
1985:     }
1986: 
1987:     /**
1988:      * Deletes all rows from the rewriting table.
1989:      *
1990:      * @param      PropelPDO $con the connection to use
1991:      * @return int             The number of affected rows (if supported by underlying database driver).
1992:      * @throws PropelException
1993:      */
1994:     public static function doDeleteAll(PropelPDO $con = null)
1995:     {
1996:         if ($con === null) {
1997:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1998:         }
1999:         $affectedRows = 0; // initialize var to track total num of affected rows
2000:         try {
2001:             // use transaction because $criteria could contain info
2002:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
2003:             $con->beginTransaction();
2004:             $affectedRows += BasePeer::doDeleteAll(RewritingPeer::TABLE_NAME, $con, RewritingPeer::DATABASE_NAME);
2005:             // Because this db requires some delete cascade/set null emulation, we have to
2006:             // clear the cached instance *after* the emulation has happened (since
2007:             // instances get re-added by the select statement contained therein).
2008:             RewritingPeer::clearInstancePool();
2009:             RewritingPeer::clearRelatedInstancePool();
2010:             $con->commit();
2011: 
2012:             return $affectedRows;
2013:         } catch (PropelException $e) {
2014:             $con->rollBack();
2015:             throw $e;
2016:         }
2017:     }
2018: 
2019:     /**
2020:      * Performs a DELETE on the database, given a Rewriting or Criteria object OR a primary key value.
2021:      *
2022:      * @param      mixed $values Criteria or Rewriting object or primary key or array of primary keys
2023:      *              which is used to create the DELETE statement
2024:      * @param      PropelPDO $con the connection to use
2025:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
2026:      *              if supported by native driver or if emulated using Propel.
2027:      * @throws PropelException Any exceptions caught during processing will be
2028:      *       rethrown wrapped into a PropelException.
2029:      */
2030:      public static function doDelete($values, PropelPDO $con = null)
2031:      {
2032:         if ($con === null) {
2033:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
2034:         }
2035: 
2036:         if ($values instanceof Criteria) {
2037:             // invalidate the cache for all objects of this type, since we have no
2038:             // way of knowing (without running a query) what objects should be invalidated
2039:             // from the cache based on this Criteria.
2040:             RewritingPeer::clearInstancePool();
2041:             // rename for clarity
2042:             $criteria = clone $values;
2043:         } elseif ($values instanceof Rewriting) { // it's a model object
2044:             // invalidate the cache for this single object
2045:             RewritingPeer::removeInstanceFromPool($values);
2046:             // create criteria based on pk values
2047:             $criteria = $values->buildPkeyCriteria();
2048:         } else { // it's a primary key, or an array of pks
2049:             $criteria = new Criteria(RewritingPeer::DATABASE_NAME);
2050:             $criteria->add(RewritingPeer::ID, (array) $values, Criteria::IN);
2051:             // invalidate the cache for this object(s)
2052:             foreach ((array) $values as $singleval) {
2053:                 RewritingPeer::removeInstanceFromPool($singleval);
2054:             }
2055:         }
2056: 
2057:         // Set the correct dbName
2058:         $criteria->setDbName(RewritingPeer::DATABASE_NAME);
2059: 
2060:         $affectedRows = 0; // initialize var to track total num of affected rows
2061: 
2062:         try {
2063:             // use transaction because $criteria could contain info
2064:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
2065:             $con->beginTransaction();
2066: 
2067:             $affectedRows += BasePeer::doDelete($criteria, $con);
2068:             RewritingPeer::clearRelatedInstancePool();
2069:             $con->commit();
2070: 
2071:             return $affectedRows;
2072:         } catch (PropelException $e) {
2073:             $con->rollBack();
2074:             throw $e;
2075:         }
2076:     }
2077: 
2078:     /**
2079:      * Validates all modified columns of given Rewriting object.
2080:      * If parameter $columns is either a single column name or an array of column names
2081:      * than only those columns are validated.
2082:      *
2083:      * NOTICE: This does not apply to primary or foreign keys for now.
2084:      *
2085:      * @param      Rewriting $obj The object to validate.
2086:      * @param      mixed $cols Column name or array of column names.
2087:      *
2088:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
2089:      */
2090:     public static function doValidate($obj, $cols = null)
2091:     {
2092:         $columns = array();
2093: 
2094:         if ($cols) {
2095:             $dbMap = Propel::getDatabaseMap(RewritingPeer::DATABASE_NAME);
2096:             $tableMap = $dbMap->getTable(RewritingPeer::TABLE_NAME);
2097: 
2098:             if (! is_array($cols)) {
2099:                 $cols = array($cols);
2100:             }
2101: 
2102:             foreach ($cols as $colName) {
2103:                 if ($tableMap->hasColumn($colName)) {
2104:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
2105:                     $columns[$colName] = $obj->$get();
2106:                 }
2107:             }
2108:         } else {
2109: 
2110:         }
2111: 
2112:         return BasePeer::doValidate(RewritingPeer::DATABASE_NAME, RewritingPeer::TABLE_NAME, $columns);
2113:     }
2114: 
2115:     /**
2116:      * Retrieve a single object by pkey.
2117:      *
2118:      * @param      int $pk the primary key.
2119:      * @param      PropelPDO $con the connection to use
2120:      * @return Rewriting
2121:      */
2122:     public static function retrieveByPK($pk, PropelPDO $con = null)
2123:     {
2124: 
2125:         if (null !== ($obj = RewritingPeer::getInstanceFromPool((string) $pk))) {
2126:             return $obj;
2127:         }
2128: 
2129:         if ($con === null) {
2130:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
2131:         }
2132: 
2133:         $criteria = new Criteria(RewritingPeer::DATABASE_NAME);
2134:         $criteria->add(RewritingPeer::ID, $pk);
2135: 
2136:         $v = RewritingPeer::doSelect($criteria, $con);
2137: 
2138:         return !empty($v) > 0 ? $v[0] : null;
2139:     }
2140: 
2141:     /**
2142:      * Retrieve multiple objects by pkey.
2143:      *
2144:      * @param      array $pks List of primary keys
2145:      * @param      PropelPDO $con the connection to use
2146:      * @return Rewriting[]
2147:      * @throws PropelException Any exceptions caught during processing will be
2148:      *       rethrown wrapped into a PropelException.
2149:      */
2150:     public static function retrieveByPKs($pks, PropelPDO $con = null)
2151:     {
2152:         if ($con === null) {
2153:             $con = Propel::getConnection(RewritingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
2154:         }
2155: 
2156:         $objs = null;
2157:         if (empty($pks)) {
2158:             $objs = array();
2159:         } else {
2160:             $criteria = new Criteria(RewritingPeer::DATABASE_NAME);
2161:             $criteria->add(RewritingPeer::ID, $pks, Criteria::IN);
2162:             $objs = RewritingPeer::doSelect($criteria, $con);
2163:         }
2164: 
2165:         return $objs;
2166:     }
2167: 
2168: } // BaseRewritingPeer
2169: 
2170: // This is the static code needed to register the TableMap for this table with the main Propel class.
2171: //
2172: BaseRewritingPeer::buildTableMap();
2173: 
2174: 
thelia API documentation generated by ApiGen 2.8.0