Overview

Namespaces

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

Classes

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