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