Overview

Namespaces

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

Classes

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