Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

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\ContentPeer;
  13: use Thelia\Model\ContentVersion;
  14: use Thelia\Model\ContentVersionPeer;
  15: use Thelia\Model\map\ContentVersionTableMap;
  16: 
  17: /**
  18:  * Base static class for performing query and update operations on the 'content_version' table.
  19:  *
  20:  *
  21:  *
  22:  * @package propel.generator.Thelia.Model.om
  23:  */
  24: abstract class BaseContentVersionPeer
  25: {
  26: 
  27:     /** the default database name for this class */
  28:     const DATABASE_NAME = 'thelia';
  29: 
  30:     /** the table name for this class */
  31:     const TABLE_NAME = 'content_version';
  32: 
  33:     /** the related Propel class for this table */
  34:     const OM_CLASS = 'Thelia\\Model\\ContentVersion';
  35: 
  36:     /** the related TableMap class for this table */
  37:     const TM_CLASS = 'ContentVersionTableMap';
  38: 
  39:     /** The total number of columns. */
  40:     const NUM_COLUMNS = 8;
  41: 
  42:     /** The number of lazy-loaded columns. */
  43:     const NUM_LAZY_LOAD_COLUMNS = 0;
  44: 
  45:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  46:     const NUM_HYDRATE_COLUMNS = 8;
  47: 
  48:     /** the column name for the id field */
  49:     const ID = 'content_version.id';
  50: 
  51:     /** the column name for the visible field */
  52:     const VISIBLE = 'content_version.visible';
  53: 
  54:     /** the column name for the position field */
  55:     const POSITION = 'content_version.position';
  56: 
  57:     /** the column name for the created_at field */
  58:     const CREATED_AT = 'content_version.created_at';
  59: 
  60:     /** the column name for the updated_at field */
  61:     const UPDATED_AT = 'content_version.updated_at';
  62: 
  63:     /** the column name for the version field */
  64:     const VERSION = 'content_version.version';
  65: 
  66:     /** the column name for the version_created_at field */
  67:     const VERSION_CREATED_AT = 'content_version.version_created_at';
  68: 
  69:     /** the column name for the version_created_by field */
  70:     const VERSION_CREATED_BY = 'content_version.version_created_by';
  71: 
  72:     /** The default string format for model objects of the related table **/
  73:     const DEFAULT_STRING_FORMAT = 'YAML';
  74: 
  75:     /**
  76:      * An identiy map to hold any loaded instances of ContentVersion objects.
  77:      * This must be public so that other peer classes can access this when hydrating from JOIN
  78:      * queries.
  79:      * @var        array ContentVersion[]
  80:      */
  81:     public static $instances = array();
  82: 
  83: 
  84:     /**
  85:      * holds an array of fieldnames
  86:      *
  87:      * first dimension keys are the type constants
  88:      * e.g. ContentVersionPeer::$fieldNames[ContentVersionPeer::TYPE_PHPNAME][0] = 'Id'
  89:      */
  90:     protected static $fieldNames = array (
  91:         BasePeer::TYPE_PHPNAME => array ('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
  92:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
  93:         BasePeer::TYPE_COLNAME => array (ContentVersionPeer::ID, ContentVersionPeer::VISIBLE, ContentVersionPeer::POSITION, ContentVersionPeer::CREATED_AT, ContentVersionPeer::UPDATED_AT, ContentVersionPeer::VERSION, ContentVersionPeer::VERSION_CREATED_AT, ContentVersionPeer::VERSION_CREATED_BY, ),
  94:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
  95:         BasePeer::TYPE_FIELDNAME => array ('id', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
  96:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
  97:     );
  98: 
  99:     /**
 100:      * holds an array of keys for quick access to the fieldnames array
 101:      *
 102:      * first dimension keys are the type constants
 103:      * e.g. ContentVersionPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 104:      */
 105:     protected static $fieldKeys = array (
 106:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ),
 107:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ),
 108:         BasePeer::TYPE_COLNAME => array (ContentVersionPeer::ID => 0, ContentVersionPeer::VISIBLE => 1, ContentVersionPeer::POSITION => 2, ContentVersionPeer::CREATED_AT => 3, ContentVersionPeer::UPDATED_AT => 4, ContentVersionPeer::VERSION => 5, ContentVersionPeer::VERSION_CREATED_AT => 6, ContentVersionPeer::VERSION_CREATED_BY => 7, ),
 109:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ),
 110:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ),
 111:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
 112:     );
 113: 
 114:     /**
 115:      * Translates a fieldname to another type
 116:      *
 117:      * @param      string $name field name
 118:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 119:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 120:      * @param      string $toType   One of the class type constants
 121:      * @return string          translated name of the field.
 122:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 123:      */
 124:     public static function translateFieldName($name, $fromType, $toType)
 125:     {
 126:         $toNames = ContentVersionPeer::getFieldNames($toType);
 127:         $key = isset(ContentVersionPeer::$fieldKeys[$fromType][$name]) ? ContentVersionPeer::$fieldKeys[$fromType][$name] : null;
 128:         if ($key === null) {
 129:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ContentVersionPeer::$fieldKeys[$fromType], true));
 130:         }
 131: 
 132:         return $toNames[$key];
 133:     }
 134: 
 135:     /**
 136:      * Returns an array of field names.
 137:      *
 138:      * @param      string $type The type of fieldnames to return:
 139:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 140:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 141:      * @return array           A list of field names
 142:      * @throws PropelException - if the type is not valid.
 143:      */
 144:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 145:     {
 146:         if (!array_key_exists($type, ContentVersionPeer::$fieldNames)) {
 147:             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.');
 148:         }
 149: 
 150:         return ContentVersionPeer::$fieldNames[$type];
 151:     }
 152: 
 153:     /**
 154:      * Convenience method which changes table.column to alias.column.
 155:      *
 156:      * Using this method you can maintain SQL abstraction while using column aliases.
 157:      * <code>
 158:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 159:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 160:      * </code>
 161:      * @param      string $alias The alias for the current table.
 162:      * @param      string $column The column name for current table. (i.e. ContentVersionPeer::COLUMN_NAME).
 163:      * @return string
 164:      */
 165:     public static function alias($alias, $column)
 166:     {
 167:         return str_replace(ContentVersionPeer::TABLE_NAME.'.', $alias.'.', $column);
 168:     }
 169: 
 170:     /**
 171:      * Add all the columns needed to create a new object.
 172:      *
 173:      * Note: any columns that were marked with lazyLoad="true" in the
 174:      * XML schema will not be added to the select list and only loaded
 175:      * on demand.
 176:      *
 177:      * @param      Criteria $criteria object containing the columns to add.
 178:      * @param      string   $alias    optional table alias
 179:      * @throws PropelException Any exceptions caught during processing will be
 180:      *       rethrown wrapped into a PropelException.
 181:      */
 182:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 183:     {
 184:         if (null === $alias) {
 185:             $criteria->addSelectColumn(ContentVersionPeer::ID);
 186:             $criteria->addSelectColumn(ContentVersionPeer::VISIBLE);
 187:             $criteria->addSelectColumn(ContentVersionPeer::POSITION);
 188:             $criteria->addSelectColumn(ContentVersionPeer::CREATED_AT);
 189:             $criteria->addSelectColumn(ContentVersionPeer::UPDATED_AT);
 190:             $criteria->addSelectColumn(ContentVersionPeer::VERSION);
 191:             $criteria->addSelectColumn(ContentVersionPeer::VERSION_CREATED_AT);
 192:             $criteria->addSelectColumn(ContentVersionPeer::VERSION_CREATED_BY);
 193:         } else {
 194:             $criteria->addSelectColumn($alias . '.id');
 195:             $criteria->addSelectColumn($alias . '.visible');
 196:             $criteria->addSelectColumn($alias . '.position');
 197:             $criteria->addSelectColumn($alias . '.created_at');
 198:             $criteria->addSelectColumn($alias . '.updated_at');
 199:             $criteria->addSelectColumn($alias . '.version');
 200:             $criteria->addSelectColumn($alias . '.version_created_at');
 201:             $criteria->addSelectColumn($alias . '.version_created_by');
 202:         }
 203:     }
 204: 
 205:     /**
 206:      * Returns the number of rows matching criteria.
 207:      *
 208:      * @param      Criteria $criteria
 209:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 210:      * @param      PropelPDO $con
 211:      * @return int Number of matching rows.
 212:      */
 213:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 214:     {
 215:         // we may modify criteria, so copy it first
 216:         $criteria = clone $criteria;
 217: 
 218:         // We need to set the primary table name, since in the case that there are no WHERE columns
 219:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 220:         // tables go into the FROM clause.
 221:         $criteria->setPrimaryTableName(ContentVersionPeer::TABLE_NAME);
 222: 
 223:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 224:             $criteria->setDistinct();
 225:         }
 226: 
 227:         if (!$criteria->hasSelectClause()) {
 228:             ContentVersionPeer::addSelectColumns($criteria);
 229:         }
 230: 
 231:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 232:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME); // Set the correct dbName
 233: 
 234:         if ($con === null) {
 235:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 236:         }
 237:         // BasePeer returns a PDOStatement
 238:         $stmt = BasePeer::doCount($criteria, $con);
 239: 
 240:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 241:             $count = (int) $row[0];
 242:         } else {
 243:             $count = 0; // no rows returned; we infer that means 0 matches.
 244:         }
 245:         $stmt->closeCursor();
 246: 
 247:         return $count;
 248:     }
 249:     /**
 250:      * Selects one object from the DB.
 251:      *
 252:      * @param      Criteria $criteria object used to create the SELECT statement.
 253:      * @param      PropelPDO $con
 254:      * @return                 ContentVersion
 255:      * @throws PropelException Any exceptions caught during processing will be
 256:      *       rethrown wrapped into a PropelException.
 257:      */
 258:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 259:     {
 260:         $critcopy = clone $criteria;
 261:         $critcopy->setLimit(1);
 262:         $objects = ContentVersionPeer::doSelect($critcopy, $con);
 263:         if ($objects) {
 264:             return $objects[0];
 265:         }
 266: 
 267:         return null;
 268:     }
 269:     /**
 270:      * Selects several row from the DB.
 271:      *
 272:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 273:      * @param      PropelPDO $con
 274:      * @return array           Array of selected Objects
 275:      * @throws PropelException Any exceptions caught during processing will be
 276:      *       rethrown wrapped into a PropelException.
 277:      */
 278:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 279:     {
 280:         return ContentVersionPeer::populateObjects(ContentVersionPeer::doSelectStmt($criteria, $con));
 281:     }
 282:     /**
 283:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 284:      *
 285:      * Use this method directly if you want to work with an executed statement directly (for example
 286:      * to perform your own object hydration).
 287:      *
 288:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 289:      * @param      PropelPDO $con The connection to use
 290:      * @throws PropelException Any exceptions caught during processing will be
 291:      *       rethrown wrapped into a PropelException.
 292:      * @return PDOStatement The executed PDOStatement object.
 293:      * @see        BasePeer::doSelect()
 294:      */
 295:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 296:     {
 297:         if ($con === null) {
 298:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 299:         }
 300: 
 301:         if (!$criteria->hasSelectClause()) {
 302:             $criteria = clone $criteria;
 303:             ContentVersionPeer::addSelectColumns($criteria);
 304:         }
 305: 
 306:         // Set the correct dbName
 307:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 308: 
 309:         // BasePeer returns a PDOStatement
 310:         return BasePeer::doSelect($criteria, $con);
 311:     }
 312:     /**
 313:      * Adds an object to the instance pool.
 314:      *
 315:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 316:      * from the database.  In some cases -- especially when you override doSelect*()
 317:      * methods in your stub classes -- you may need to explicitly add objects
 318:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 319:      * and retrieveByPK*() calls.
 320:      *
 321:      * @param      ContentVersion $obj A ContentVersion object.
 322:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 323:      */
 324:     public static function addInstanceToPool($obj, $key = null)
 325:     {
 326:         if (Propel::isInstancePoolingEnabled()) {
 327:             if ($key === null) {
 328:                 $key = serialize(array((string) $obj->getId(), (string) $obj->getVersion()));
 329:             } // if key === null
 330:             ContentVersionPeer::$instances[$key] = $obj;
 331:         }
 332:     }
 333: 
 334:     /**
 335:      * Removes an object from the instance pool.
 336:      *
 337:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 338:      * from the database.  In some cases -- especially when you override doDelete
 339:      * methods in your stub classes -- you may need to explicitly remove objects
 340:      * from the cache in order to prevent returning objects that no longer exist.
 341:      *
 342:      * @param      mixed $value A ContentVersion object or a primary key value.
 343:      *
 344:      * @return void
 345:      * @throws PropelException - if the value is invalid.
 346:      */
 347:     public static function removeInstanceFromPool($value)
 348:     {
 349:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 350:             if (is_object($value) && $value instanceof ContentVersion) {
 351:                 $key = serialize(array((string) $value->getId(), (string) $value->getVersion()));
 352:             } elseif (is_array($value) && count($value) === 2) {
 353:                 // assume we've been passed a primary key
 354:                 $key = serialize(array((string) $value[0], (string) $value[1]));
 355:             } else {
 356:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or ContentVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 357:                 throw $e;
 358:             }
 359: 
 360:             unset(ContentVersionPeer::$instances[$key]);
 361:         }
 362:     } // removeInstanceFromPool()
 363: 
 364:     /**
 365:      * 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.
 366:      *
 367:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 368:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 369:      *
 370:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 371:      * @return   ContentVersion Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 372:      * @see        getPrimaryKeyHash()
 373:      */
 374:     public static function getInstanceFromPool($key)
 375:     {
 376:         if (Propel::isInstancePoolingEnabled()) {
 377:             if (isset(ContentVersionPeer::$instances[$key])) {
 378:                 return ContentVersionPeer::$instances[$key];
 379:             }
 380:         }
 381: 
 382:         return null; // just to be explicit
 383:     }
 384: 
 385:     /**
 386:      * Clear the instance pool.
 387:      *
 388:      * @return void
 389:      */
 390:     public static function clearInstancePool($and_clear_all_references = false)
 391:     {
 392:       if ($and_clear_all_references)
 393:       {
 394:         foreach (ContentVersionPeer::$instances as $instance)
 395:         {
 396:           $instance->clearAllReferences(true);
 397:         }
 398:       }
 399:         ContentVersionPeer::$instances = array();
 400:     }
 401: 
 402:     /**
 403:      * Method to invalidate the instance pool of all tables related to content_version
 404:      * by a foreign key with ON DELETE CASCADE
 405:      */
 406:     public static function clearRelatedInstancePool()
 407:     {
 408:     }
 409: 
 410:     /**
 411:      * 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.
 412:      *
 413:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 414:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 415:      *
 416:      * @param      array $row PropelPDO resultset row.
 417:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 418:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 419:      */
 420:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 421:     {
 422:         // If the PK cannot be derived from the row, return null.
 423:         if ($row[$startcol] === null && $row[$startcol + 5] === null) {
 424:             return null;
 425:         }
 426: 
 427:         return serialize(array((string) $row[$startcol], (string) $row[$startcol + 5]));
 428:     }
 429: 
 430:     /**
 431:      * Retrieves the primary key from the DB resultset row
 432:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 433:      * a multi-column primary key, an array of the primary key columns will be returned.
 434:      *
 435:      * @param      array $row PropelPDO resultset row.
 436:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 437:      * @return mixed The primary key of the row
 438:      */
 439:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 440:     {
 441: 
 442:         return array((int) $row[$startcol], (int) $row[$startcol + 5]);
 443:     }
 444: 
 445:     /**
 446:      * The returned array will contain objects of the default type or
 447:      * objects that inherit from the default.
 448:      *
 449:      * @throws PropelException Any exceptions caught during processing will be
 450:      *       rethrown wrapped into a PropelException.
 451:      */
 452:     public static function populateObjects(PDOStatement $stmt)
 453:     {
 454:         $results = array();
 455: 
 456:         // set the class once to avoid overhead in the loop
 457:         $cls = ContentVersionPeer::getOMClass();
 458:         // populate the object(s)
 459:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 460:             $key = ContentVersionPeer::getPrimaryKeyHashFromRow($row, 0);
 461:             if (null !== ($obj = ContentVersionPeer::getInstanceFromPool($key))) {
 462:                 // We no longer rehydrate the object, since this can cause data loss.
 463:                 // See http://www.propelorm.org/ticket/509
 464:                 // $obj->hydrate($row, 0, true); // rehydrate
 465:                 $results[] = $obj;
 466:             } else {
 467:                 $obj = new $cls();
 468:                 $obj->hydrate($row);
 469:                 $results[] = $obj;
 470:                 ContentVersionPeer::addInstanceToPool($obj, $key);
 471:             } // if key exists
 472:         }
 473:         $stmt->closeCursor();
 474: 
 475:         return $results;
 476:     }
 477:     /**
 478:      * Populates an object of the default type or an object that inherit from the default.
 479:      *
 480:      * @param      array $row PropelPDO resultset row.
 481:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 482:      * @throws PropelException Any exceptions caught during processing will be
 483:      *       rethrown wrapped into a PropelException.
 484:      * @return array (ContentVersion object, last column rank)
 485:      */
 486:     public static function populateObject($row, $startcol = 0)
 487:     {
 488:         $key = ContentVersionPeer::getPrimaryKeyHashFromRow($row, $startcol);
 489:         if (null !== ($obj = ContentVersionPeer::getInstanceFromPool($key))) {
 490:             // We no longer rehydrate the object, since this can cause data loss.
 491:             // See http://www.propelorm.org/ticket/509
 492:             // $obj->hydrate($row, $startcol, true); // rehydrate
 493:             $col = $startcol + ContentVersionPeer::NUM_HYDRATE_COLUMNS;
 494:         } else {
 495:             $cls = ContentVersionPeer::OM_CLASS;
 496:             $obj = new $cls();
 497:             $col = $obj->hydrate($row, $startcol);
 498:             ContentVersionPeer::addInstanceToPool($obj, $key);
 499:         }
 500: 
 501:         return array($obj, $col);
 502:     }
 503: 
 504: 
 505:     /**
 506:      * Returns the number of rows matching criteria, joining the related Content table
 507:      *
 508:      * @param      Criteria $criteria
 509:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 510:      * @param      PropelPDO $con
 511:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 512:      * @return int Number of matching rows.
 513:      */
 514:     public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 515:     {
 516:         // we're going to modify criteria, so copy it first
 517:         $criteria = clone $criteria;
 518: 
 519:         // We need to set the primary table name, since in the case that there are no WHERE columns
 520:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 521:         // tables go into the FROM clause.
 522:         $criteria->setPrimaryTableName(ContentVersionPeer::TABLE_NAME);
 523: 
 524:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 525:             $criteria->setDistinct();
 526:         }
 527: 
 528:         if (!$criteria->hasSelectClause()) {
 529:             ContentVersionPeer::addSelectColumns($criteria);
 530:         }
 531: 
 532:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 533: 
 534:         // Set the correct dbName
 535:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 536: 
 537:         if ($con === null) {
 538:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 539:         }
 540: 
 541:         $criteria->addJoin(ContentVersionPeer::ID, ContentPeer::ID, $join_behavior);
 542: 
 543:         $stmt = BasePeer::doCount($criteria, $con);
 544: 
 545:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 546:             $count = (int) $row[0];
 547:         } else {
 548:             $count = 0; // no rows returned; we infer that means 0 matches.
 549:         }
 550:         $stmt->closeCursor();
 551: 
 552:         return $count;
 553:     }
 554: 
 555: 
 556:     /**
 557:      * Selects a collection of ContentVersion objects pre-filled with their Content objects.
 558:      * @param      Criteria  $criteria
 559:      * @param      PropelPDO $con
 560:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 561:      * @return array           Array of ContentVersion objects.
 562:      * @throws PropelException Any exceptions caught during processing will be
 563:      *       rethrown wrapped into a PropelException.
 564:      */
 565:     public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 566:     {
 567:         $criteria = clone $criteria;
 568: 
 569:         // Set the correct dbName if it has not been overridden
 570:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 571:             $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 572:         }
 573: 
 574:         ContentVersionPeer::addSelectColumns($criteria);
 575:         $startcol = ContentVersionPeer::NUM_HYDRATE_COLUMNS;
 576:         ContentPeer::addSelectColumns($criteria);
 577: 
 578:         $criteria->addJoin(ContentVersionPeer::ID, ContentPeer::ID, $join_behavior);
 579: 
 580:         $stmt = BasePeer::doSelect($criteria, $con);
 581:         $results = array();
 582: 
 583:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 584:             $key1 = ContentVersionPeer::getPrimaryKeyHashFromRow($row, 0);
 585:             if (null !== ($obj1 = ContentVersionPeer::getInstanceFromPool($key1))) {
 586:                 // We no longer rehydrate the object, since this can cause data loss.
 587:                 // See http://www.propelorm.org/ticket/509
 588:                 // $obj1->hydrate($row, 0, true); // rehydrate
 589:             } else {
 590: 
 591:                 $cls = ContentVersionPeer::getOMClass();
 592: 
 593:                 $obj1 = new $cls();
 594:                 $obj1->hydrate($row);
 595:                 ContentVersionPeer::addInstanceToPool($obj1, $key1);
 596:             } // if $obj1 already loaded
 597: 
 598:             $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
 599:             if ($key2 !== null) {
 600:                 $obj2 = ContentPeer::getInstanceFromPool($key2);
 601:                 if (!$obj2) {
 602: 
 603:                     $cls = ContentPeer::getOMClass();
 604: 
 605:                     $obj2 = new $cls();
 606:                     $obj2->hydrate($row, $startcol);
 607:                     ContentPeer::addInstanceToPool($obj2, $key2);
 608:                 } // if obj2 already loaded
 609: 
 610:                 // Add the $obj1 (ContentVersion) to $obj2 (Content)
 611:                 $obj2->addContentVersion($obj1);
 612: 
 613:             } // if joined row was not null
 614: 
 615:             $results[] = $obj1;
 616:         }
 617:         $stmt->closeCursor();
 618: 
 619:         return $results;
 620:     }
 621: 
 622: 
 623:     /**
 624:      * Returns the number of rows matching criteria, joining all related tables
 625:      *
 626:      * @param      Criteria $criteria
 627:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 628:      * @param      PropelPDO $con
 629:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 630:      * @return int Number of matching rows.
 631:      */
 632:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 633:     {
 634:         // we're going to modify criteria, so copy it first
 635:         $criteria = clone $criteria;
 636: 
 637:         // We need to set the primary table name, since in the case that there are no WHERE columns
 638:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 639:         // tables go into the FROM clause.
 640:         $criteria->setPrimaryTableName(ContentVersionPeer::TABLE_NAME);
 641: 
 642:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 643:             $criteria->setDistinct();
 644:         }
 645: 
 646:         if (!$criteria->hasSelectClause()) {
 647:             ContentVersionPeer::addSelectColumns($criteria);
 648:         }
 649: 
 650:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 651: 
 652:         // Set the correct dbName
 653:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 654: 
 655:         if ($con === null) {
 656:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 657:         }
 658: 
 659:         $criteria->addJoin(ContentVersionPeer::ID, ContentPeer::ID, $join_behavior);
 660: 
 661:         $stmt = BasePeer::doCount($criteria, $con);
 662: 
 663:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 664:             $count = (int) $row[0];
 665:         } else {
 666:             $count = 0; // no rows returned; we infer that means 0 matches.
 667:         }
 668:         $stmt->closeCursor();
 669: 
 670:         return $count;
 671:     }
 672: 
 673:     /**
 674:      * Selects a collection of ContentVersion objects pre-filled with all related objects.
 675:      *
 676:      * @param      Criteria  $criteria
 677:      * @param      PropelPDO $con
 678:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 679:      * @return array           Array of ContentVersion objects.
 680:      * @throws PropelException Any exceptions caught during processing will be
 681:      *       rethrown wrapped into a PropelException.
 682:      */
 683:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 684:     {
 685:         $criteria = clone $criteria;
 686: 
 687:         // Set the correct dbName if it has not been overridden
 688:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 689:             $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 690:         }
 691: 
 692:         ContentVersionPeer::addSelectColumns($criteria);
 693:         $startcol2 = ContentVersionPeer::NUM_HYDRATE_COLUMNS;
 694: 
 695:         ContentPeer::addSelectColumns($criteria);
 696:         $startcol3 = $startcol2 + ContentPeer::NUM_HYDRATE_COLUMNS;
 697: 
 698:         $criteria->addJoin(ContentVersionPeer::ID, ContentPeer::ID, $join_behavior);
 699: 
 700:         $stmt = BasePeer::doSelect($criteria, $con);
 701:         $results = array();
 702: 
 703:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 704:             $key1 = ContentVersionPeer::getPrimaryKeyHashFromRow($row, 0);
 705:             if (null !== ($obj1 = ContentVersionPeer::getInstanceFromPool($key1))) {
 706:                 // We no longer rehydrate the object, since this can cause data loss.
 707:                 // See http://www.propelorm.org/ticket/509
 708:                 // $obj1->hydrate($row, 0, true); // rehydrate
 709:             } else {
 710:                 $cls = ContentVersionPeer::getOMClass();
 711: 
 712:                 $obj1 = new $cls();
 713:                 $obj1->hydrate($row);
 714:                 ContentVersionPeer::addInstanceToPool($obj1, $key1);
 715:             } // if obj1 already loaded
 716: 
 717:             // Add objects for joined Content rows
 718: 
 719:             $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol2);
 720:             if ($key2 !== null) {
 721:                 $obj2 = ContentPeer::getInstanceFromPool($key2);
 722:                 if (!$obj2) {
 723: 
 724:                     $cls = ContentPeer::getOMClass();
 725: 
 726:                     $obj2 = new $cls();
 727:                     $obj2->hydrate($row, $startcol2);
 728:                     ContentPeer::addInstanceToPool($obj2, $key2);
 729:                 } // if obj2 loaded
 730: 
 731:                 // Add the $obj1 (ContentVersion) to the collection in $obj2 (Content)
 732:                 $obj2->addContentVersion($obj1);
 733:             } // if joined row not null
 734: 
 735:             $results[] = $obj1;
 736:         }
 737:         $stmt->closeCursor();
 738: 
 739:         return $results;
 740:     }
 741: 
 742:     /**
 743:      * Returns the TableMap related to this peer.
 744:      * This method is not needed for general use but a specific application could have a need.
 745:      * @return TableMap
 746:      * @throws PropelException Any exceptions caught during processing will be
 747:      *       rethrown wrapped into a PropelException.
 748:      */
 749:     public static function getTableMap()
 750:     {
 751:         return Propel::getDatabaseMap(ContentVersionPeer::DATABASE_NAME)->getTable(ContentVersionPeer::TABLE_NAME);
 752:     }
 753: 
 754:     /**
 755:      * Add a TableMap instance to the database for this peer class.
 756:      */
 757:     public static function buildTableMap()
 758:     {
 759:       $dbMap = Propel::getDatabaseMap(BaseContentVersionPeer::DATABASE_NAME);
 760:       if (!$dbMap->hasTable(BaseContentVersionPeer::TABLE_NAME)) {
 761:         $dbMap->addTableObject(new ContentVersionTableMap());
 762:       }
 763:     }
 764: 
 765:     /**
 766:      * The class that the Peer will make instances of.
 767:      *
 768:      *
 769:      * @return string ClassName
 770:      */
 771:     public static function getOMClass($row = 0, $colnum = 0)
 772:     {
 773:         return ContentVersionPeer::OM_CLASS;
 774:     }
 775: 
 776:     /**
 777:      * Performs an INSERT on the database, given a ContentVersion or Criteria object.
 778:      *
 779:      * @param      mixed $values Criteria or ContentVersion object containing data that is used to create the INSERT statement.
 780:      * @param      PropelPDO $con the PropelPDO connection to use
 781:      * @return mixed           The new primary key.
 782:      * @throws PropelException Any exceptions caught during processing will be
 783:      *       rethrown wrapped into a PropelException.
 784:      */
 785:     public static function doInsert($values, PropelPDO $con = null)
 786:     {
 787:         if ($con === null) {
 788:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 789:         }
 790: 
 791:         if ($values instanceof Criteria) {
 792:             $criteria = clone $values; // rename for clarity
 793:         } else {
 794:             $criteria = $values->buildCriteria(); // build Criteria from ContentVersion object
 795:         }
 796: 
 797: 
 798:         // Set the correct dbName
 799:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 800: 
 801:         try {
 802:             // use transaction because $criteria could contain info
 803:             // for more than one table (I guess, conceivably)
 804:             $con->beginTransaction();
 805:             $pk = BasePeer::doInsert($criteria, $con);
 806:             $con->commit();
 807:         } catch (PropelException $e) {
 808:             $con->rollBack();
 809:             throw $e;
 810:         }
 811: 
 812:         return $pk;
 813:     }
 814: 
 815:     /**
 816:      * Performs an UPDATE on the database, given a ContentVersion or Criteria object.
 817:      *
 818:      * @param      mixed $values Criteria or ContentVersion object containing data that is used to create the UPDATE statement.
 819:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
 820:      * @return int             The number of affected rows (if supported by underlying database driver).
 821:      * @throws PropelException Any exceptions caught during processing will be
 822:      *       rethrown wrapped into a PropelException.
 823:      */
 824:     public static function doUpdate($values, PropelPDO $con = null)
 825:     {
 826:         if ($con === null) {
 827:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 828:         }
 829: 
 830:         $selectCriteria = new Criteria(ContentVersionPeer::DATABASE_NAME);
 831: 
 832:         if ($values instanceof Criteria) {
 833:             $criteria = clone $values; // rename for clarity
 834: 
 835:             $comparison = $criteria->getComparison(ContentVersionPeer::ID);
 836:             $value = $criteria->remove(ContentVersionPeer::ID);
 837:             if ($value) {
 838:                 $selectCriteria->add(ContentVersionPeer::ID, $value, $comparison);
 839:             } else {
 840:                 $selectCriteria->setPrimaryTableName(ContentVersionPeer::TABLE_NAME);
 841:             }
 842: 
 843:             $comparison = $criteria->getComparison(ContentVersionPeer::VERSION);
 844:             $value = $criteria->remove(ContentVersionPeer::VERSION);
 845:             if ($value) {
 846:                 $selectCriteria->add(ContentVersionPeer::VERSION, $value, $comparison);
 847:             } else {
 848:                 $selectCriteria->setPrimaryTableName(ContentVersionPeer::TABLE_NAME);
 849:             }
 850: 
 851:         } else { // $values is ContentVersion object
 852:             $criteria = $values->buildCriteria(); // gets full criteria
 853:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
 854:         }
 855: 
 856:         // set the correct dbName
 857:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 858: 
 859:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
 860:     }
 861: 
 862:     /**
 863:      * Deletes all rows from the content_version table.
 864:      *
 865:      * @param      PropelPDO $con the connection to use
 866:      * @return int             The number of affected rows (if supported by underlying database driver).
 867:      * @throws PropelException
 868:      */
 869:     public static function doDeleteAll(PropelPDO $con = null)
 870:     {
 871:         if ($con === null) {
 872:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 873:         }
 874:         $affectedRows = 0; // initialize var to track total num of affected rows
 875:         try {
 876:             // use transaction because $criteria could contain info
 877:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 878:             $con->beginTransaction();
 879:             $affectedRows += BasePeer::doDeleteAll(ContentVersionPeer::TABLE_NAME, $con, ContentVersionPeer::DATABASE_NAME);
 880:             // Because this db requires some delete cascade/set null emulation, we have to
 881:             // clear the cached instance *after* the emulation has happened (since
 882:             // instances get re-added by the select statement contained therein).
 883:             ContentVersionPeer::clearInstancePool();
 884:             ContentVersionPeer::clearRelatedInstancePool();
 885:             $con->commit();
 886: 
 887:             return $affectedRows;
 888:         } catch (PropelException $e) {
 889:             $con->rollBack();
 890:             throw $e;
 891:         }
 892:     }
 893: 
 894:     /**
 895:      * Performs a DELETE on the database, given a ContentVersion or Criteria object OR a primary key value.
 896:      *
 897:      * @param      mixed $values Criteria or ContentVersion object or primary key or array of primary keys
 898:      *              which is used to create the DELETE statement
 899:      * @param      PropelPDO $con the connection to use
 900:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
 901:      *              if supported by native driver or if emulated using Propel.
 902:      * @throws PropelException Any exceptions caught during processing will be
 903:      *       rethrown wrapped into a PropelException.
 904:      */
 905:      public static function doDelete($values, PropelPDO $con = null)
 906:      {
 907:         if ($con === null) {
 908:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 909:         }
 910: 
 911:         if ($values instanceof Criteria) {
 912:             // invalidate the cache for all objects of this type, since we have no
 913:             // way of knowing (without running a query) what objects should be invalidated
 914:             // from the cache based on this Criteria.
 915:             ContentVersionPeer::clearInstancePool();
 916:             // rename for clarity
 917:             $criteria = clone $values;
 918:         } elseif ($values instanceof ContentVersion) { // it's a model object
 919:             // invalidate the cache for this single object
 920:             ContentVersionPeer::removeInstanceFromPool($values);
 921:             // create criteria based on pk values
 922:             $criteria = $values->buildPkeyCriteria();
 923:         } else { // it's a primary key, or an array of pks
 924:             $criteria = new Criteria(ContentVersionPeer::DATABASE_NAME);
 925:             // primary key is composite; we therefore, expect
 926:             // the primary key passed to be an array of pkey values
 927:             if (count($values) == count($values, COUNT_RECURSIVE)) {
 928:                 // array is not multi-dimensional
 929:                 $values = array($values);
 930:             }
 931:             foreach ($values as $value) {
 932:                 $criterion = $criteria->getNewCriterion(ContentVersionPeer::ID, $value[0]);
 933:                 $criterion->addAnd($criteria->getNewCriterion(ContentVersionPeer::VERSION, $value[1]));
 934:                 $criteria->addOr($criterion);
 935:                 // we can invalidate the cache for this single PK
 936:                 ContentVersionPeer::removeInstanceFromPool($value);
 937:             }
 938:         }
 939: 
 940:         // Set the correct dbName
 941:         $criteria->setDbName(ContentVersionPeer::DATABASE_NAME);
 942: 
 943:         $affectedRows = 0; // initialize var to track total num of affected rows
 944: 
 945:         try {
 946:             // use transaction because $criteria could contain info
 947:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 948:             $con->beginTransaction();
 949: 
 950:             $affectedRows += BasePeer::doDelete($criteria, $con);
 951:             ContentVersionPeer::clearRelatedInstancePool();
 952:             $con->commit();
 953: 
 954:             return $affectedRows;
 955:         } catch (PropelException $e) {
 956:             $con->rollBack();
 957:             throw $e;
 958:         }
 959:     }
 960: 
 961:     /**
 962:      * Validates all modified columns of given ContentVersion object.
 963:      * If parameter $columns is either a single column name or an array of column names
 964:      * than only those columns are validated.
 965:      *
 966:      * NOTICE: This does not apply to primary or foreign keys for now.
 967:      *
 968:      * @param      ContentVersion $obj The object to validate.
 969:      * @param      mixed $cols Column name or array of column names.
 970:      *
 971:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
 972:      */
 973:     public static function doValidate($obj, $cols = null)
 974:     {
 975:         $columns = array();
 976: 
 977:         if ($cols) {
 978:             $dbMap = Propel::getDatabaseMap(ContentVersionPeer::DATABASE_NAME);
 979:             $tableMap = $dbMap->getTable(ContentVersionPeer::TABLE_NAME);
 980: 
 981:             if (! is_array($cols)) {
 982:                 $cols = array($cols);
 983:             }
 984: 
 985:             foreach ($cols as $colName) {
 986:                 if ($tableMap->hasColumn($colName)) {
 987:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
 988:                     $columns[$colName] = $obj->$get();
 989:                 }
 990:             }
 991:         } else {
 992: 
 993:         }
 994: 
 995:         return BasePeer::doValidate(ContentVersionPeer::DATABASE_NAME, ContentVersionPeer::TABLE_NAME, $columns);
 996:     }
 997: 
 998:     /**
 999:      * Retrieve object using using composite pkey values.
1000:      * @param   int $id
1001:      * @param   int $version
1002:      * @param      PropelPDO $con
1003:      * @return   ContentVersion
1004:      */
1005:     public static function retrieveByPK($id, $version, PropelPDO $con = null) {
1006:         $_instancePoolKey = serialize(array((string) $id, (string) $version));
1007:          if (null !== ($obj = ContentVersionPeer::getInstanceFromPool($_instancePoolKey))) {
1008:              return $obj;
1009:         }
1010: 
1011:         if ($con === null) {
1012:             $con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1013:         }
1014:         $criteria = new Criteria(ContentVersionPeer::DATABASE_NAME);
1015:         $criteria->add(ContentVersionPeer::ID, $id);
1016:         $criteria->add(ContentVersionPeer::VERSION, $version);
1017:         $v = ContentVersionPeer::doSelect($criteria, $con);
1018: 
1019:         return !empty($v) ? $v[0] : null;
1020:     }
1021: } // BaseContentVersionPeer
1022: 
1023: // This is the static code needed to register the TableMap for this table with the main Propel class.
1024: //
1025: BaseContentVersionPeer::buildTableMap();
1026: 
1027: 
thelia API documentation generated by ApiGen 2.8.0