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