Overview

Namespaces

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

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