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 \BaseObject;
   6: use \BasePeer;
   7: use \Criteria;
   8: use \DateTime;
   9: use \Exception;
  10: use \PDO;
  11: use \Persistent;
  12: use \Propel;
  13: use \PropelDateTime;
  14: use \PropelException;
  15: use \PropelPDO;
  16: use Thelia\Model\Message;
  17: use Thelia\Model\MessageQuery;
  18: use Thelia\Model\MessageVersion;
  19: use Thelia\Model\MessageVersionPeer;
  20: use Thelia\Model\MessageVersionQuery;
  21: 
  22: /**
  23:  * Base class that represents a row from the 'message_version' table.
  24:  *
  25:  *
  26:  *
  27:  * @package    propel.generator.Thelia.Model.om
  28:  */
  29: abstract class BaseMessageVersion extends BaseObject implements Persistent
  30: {
  31:     /**
  32:      * Peer class name
  33:      */
  34:     const PEER = 'Thelia\\Model\\MessageVersionPeer';
  35: 
  36:     /**
  37:      * The Peer class.
  38:      * Instance provides a convenient way of calling static methods on a class
  39:      * that calling code may not be able to identify.
  40:      * @var        MessageVersionPeer
  41:      */
  42:     protected static $peer;
  43: 
  44:     /**
  45:      * The flag var to prevent infinit loop in deep copy
  46:      * @var       boolean
  47:      */
  48:     protected $startCopy = false;
  49: 
  50:     /**
  51:      * The value for the id field.
  52:      * @var        int
  53:      */
  54:     protected $id;
  55: 
  56:     /**
  57:      * The value for the code field.
  58:      * @var        string
  59:      */
  60:     protected $code;
  61: 
  62:     /**
  63:      * The value for the secured field.
  64:      * @var        int
  65:      */
  66:     protected $secured;
  67: 
  68:     /**
  69:      * The value for the ref field.
  70:      * @var        string
  71:      */
  72:     protected $ref;
  73: 
  74:     /**
  75:      * The value for the created_at field.
  76:      * @var        string
  77:      */
  78:     protected $created_at;
  79: 
  80:     /**
  81:      * The value for the updated_at field.
  82:      * @var        string
  83:      */
  84:     protected $updated_at;
  85: 
  86:     /**
  87:      * The value for the version field.
  88:      * Note: this column has a database default value of: 0
  89:      * @var        int
  90:      */
  91:     protected $version;
  92: 
  93:     /**
  94:      * The value for the version_created_at field.
  95:      * @var        string
  96:      */
  97:     protected $version_created_at;
  98: 
  99:     /**
 100:      * The value for the version_created_by field.
 101:      * @var        string
 102:      */
 103:     protected $version_created_by;
 104: 
 105:     /**
 106:      * @var        Message
 107:      */
 108:     protected $aMessage;
 109: 
 110:     /**
 111:      * Flag to prevent endless save loop, if this object is referenced
 112:      * by another object which falls in this transaction.
 113:      * @var        boolean
 114:      */
 115:     protected $alreadyInSave = false;
 116: 
 117:     /**
 118:      * Flag to prevent endless validation loop, if this object is referenced
 119:      * by another object which falls in this transaction.
 120:      * @var        boolean
 121:      */
 122:     protected $alreadyInValidation = false;
 123: 
 124:     /**
 125:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
 126:      * @var        boolean
 127:      */
 128:     protected $alreadyInClearAllReferencesDeep = false;
 129: 
 130:     /**
 131:      * Applies default values to this object.
 132:      * This method should be called from the object's constructor (or
 133:      * equivalent initialization method).
 134:      * @see        __construct()
 135:      */
 136:     public function applyDefaultValues()
 137:     {
 138:         $this->version = 0;
 139:     }
 140: 
 141:     /**
 142:      * Initializes internal state of BaseMessageVersion object.
 143:      * @see        applyDefaults()
 144:      */
 145:     public function __construct()
 146:     {
 147:         parent::__construct();
 148:         $this->applyDefaultValues();
 149:     }
 150: 
 151:     /**
 152:      * Get the [id] column value.
 153:      *
 154:      * @return int
 155:      */
 156:     public function getId()
 157:     {
 158:         return $this->id;
 159:     }
 160: 
 161:     /**
 162:      * Get the [code] column value.
 163:      *
 164:      * @return string
 165:      */
 166:     public function getCode()
 167:     {
 168:         return $this->code;
 169:     }
 170: 
 171:     /**
 172:      * Get the [secured] column value.
 173:      *
 174:      * @return int
 175:      */
 176:     public function getSecured()
 177:     {
 178:         return $this->secured;
 179:     }
 180: 
 181:     /**
 182:      * Get the [ref] column value.
 183:      *
 184:      * @return string
 185:      */
 186:     public function getRef()
 187:     {
 188:         return $this->ref;
 189:     }
 190: 
 191:     /**
 192:      * Get the [optionally formatted] temporal [created_at] column value.
 193:      *
 194:      *
 195:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 196:      *               If format is null, then the raw DateTime object will be returned.
 197:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
 198:      * @throws PropelException - if unable to parse/validate the date/time value.
 199:      */
 200:     public function getCreatedAt($format = 'Y-m-d H:i:s')
 201:     {
 202:         if ($this->created_at === null) {
 203:             return null;
 204:         }
 205: 
 206:         if ($this->created_at === '0000-00-00 00:00:00') {
 207:             // while technically this is not a default value of null,
 208:             // this seems to be closest in meaning.
 209:             return null;
 210:         }
 211: 
 212:         try {
 213:             $dt = new DateTime($this->created_at);
 214:         } catch (Exception $x) {
 215:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
 216:         }
 217: 
 218:         if ($format === null) {
 219:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 220:             return $dt;
 221:         }
 222: 
 223:         if (strpos($format, '%') !== false) {
 224:             return strftime($format, $dt->format('U'));
 225:         }
 226: 
 227:         return $dt->format($format);
 228: 
 229:     }
 230: 
 231:     /**
 232:      * Get the [optionally formatted] temporal [updated_at] column value.
 233:      *
 234:      *
 235:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 236:      *               If format is null, then the raw DateTime object will be returned.
 237:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
 238:      * @throws PropelException - if unable to parse/validate the date/time value.
 239:      */
 240:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
 241:     {
 242:         if ($this->updated_at === null) {
 243:             return null;
 244:         }
 245: 
 246:         if ($this->updated_at === '0000-00-00 00:00:00') {
 247:             // while technically this is not a default value of null,
 248:             // this seems to be closest in meaning.
 249:             return null;
 250:         }
 251: 
 252:         try {
 253:             $dt = new DateTime($this->updated_at);
 254:         } catch (Exception $x) {
 255:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
 256:         }
 257: 
 258:         if ($format === null) {
 259:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 260:             return $dt;
 261:         }
 262: 
 263:         if (strpos($format, '%') !== false) {
 264:             return strftime($format, $dt->format('U'));
 265:         }
 266: 
 267:         return $dt->format($format);
 268: 
 269:     }
 270: 
 271:     /**
 272:      * Get the [version] column value.
 273:      *
 274:      * @return int
 275:      */
 276:     public function getVersion()
 277:     {
 278:         return $this->version;
 279:     }
 280: 
 281:     /**
 282:      * Get the [optionally formatted] temporal [version_created_at] column value.
 283:      *
 284:      *
 285:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 286:      *               If format is null, then the raw DateTime object will be returned.
 287:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
 288:      * @throws PropelException - if unable to parse/validate the date/time value.
 289:      */
 290:     public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
 291:     {
 292:         if ($this->version_created_at === null) {
 293:             return null;
 294:         }
 295: 
 296:         if ($this->version_created_at === '0000-00-00 00:00:00') {
 297:             // while technically this is not a default value of null,
 298:             // this seems to be closest in meaning.
 299:             return null;
 300:         }
 301: 
 302:         try {
 303:             $dt = new DateTime($this->version_created_at);
 304:         } catch (Exception $x) {
 305:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
 306:         }
 307: 
 308:         if ($format === null) {
 309:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 310:             return $dt;
 311:         }
 312: 
 313:         if (strpos($format, '%') !== false) {
 314:             return strftime($format, $dt->format('U'));
 315:         }
 316: 
 317:         return $dt->format($format);
 318: 
 319:     }
 320: 
 321:     /**
 322:      * Get the [version_created_by] column value.
 323:      *
 324:      * @return string
 325:      */
 326:     public function getVersionCreatedBy()
 327:     {
 328:         return $this->version_created_by;
 329:     }
 330: 
 331:     /**
 332:      * Set the value of [id] column.
 333:      *
 334:      * @param int $v new value
 335:      * @return MessageVersion The current object (for fluent API support)
 336:      */
 337:     public function setId($v)
 338:     {
 339:         if ($v !== null && is_numeric($v)) {
 340:             $v = (int) $v;
 341:         }
 342: 
 343:         if ($this->id !== $v) {
 344:             $this->id = $v;
 345:             $this->modifiedColumns[] = MessageVersionPeer::ID;
 346:         }
 347: 
 348:         if ($this->aMessage !== null && $this->aMessage->getId() !== $v) {
 349:             $this->aMessage = null;
 350:         }
 351: 
 352: 
 353:         return $this;
 354:     } // setId()
 355: 
 356:     /**
 357:      * Set the value of [code] column.
 358:      *
 359:      * @param string $v new value
 360:      * @return MessageVersion The current object (for fluent API support)
 361:      */
 362:     public function setCode($v)
 363:     {
 364:         if ($v !== null && is_numeric($v)) {
 365:             $v = (string) $v;
 366:         }
 367: 
 368:         if ($this->code !== $v) {
 369:             $this->code = $v;
 370:             $this->modifiedColumns[] = MessageVersionPeer::CODE;
 371:         }
 372: 
 373: 
 374:         return $this;
 375:     } // setCode()
 376: 
 377:     /**
 378:      * Set the value of [secured] column.
 379:      *
 380:      * @param int $v new value
 381:      * @return MessageVersion The current object (for fluent API support)
 382:      */
 383:     public function setSecured($v)
 384:     {
 385:         if ($v !== null && is_numeric($v)) {
 386:             $v = (int) $v;
 387:         }
 388: 
 389:         if ($this->secured !== $v) {
 390:             $this->secured = $v;
 391:             $this->modifiedColumns[] = MessageVersionPeer::SECURED;
 392:         }
 393: 
 394: 
 395:         return $this;
 396:     } // setSecured()
 397: 
 398:     /**
 399:      * Set the value of [ref] column.
 400:      *
 401:      * @param string $v new value
 402:      * @return MessageVersion The current object (for fluent API support)
 403:      */
 404:     public function setRef($v)
 405:     {
 406:         if ($v !== null && is_numeric($v)) {
 407:             $v = (string) $v;
 408:         }
 409: 
 410:         if ($this->ref !== $v) {
 411:             $this->ref = $v;
 412:             $this->modifiedColumns[] = MessageVersionPeer::REF;
 413:         }
 414: 
 415: 
 416:         return $this;
 417:     } // setRef()
 418: 
 419:     /**
 420:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
 421:      *
 422:      * @param mixed $v string, integer (timestamp), or DateTime value.
 423:      *               Empty strings are treated as null.
 424:      * @return MessageVersion The current object (for fluent API support)
 425:      */
 426:     public function setCreatedAt($v)
 427:     {
 428:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 429:         if ($this->created_at !== null || $dt !== null) {
 430:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 431:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 432:             if ($currentDateAsString !== $newDateAsString) {
 433:                 $this->created_at = $newDateAsString;
 434:                 $this->modifiedColumns[] = MessageVersionPeer::CREATED_AT;
 435:             }
 436:         } // if either are not null
 437: 
 438: 
 439:         return $this;
 440:     } // setCreatedAt()
 441: 
 442:     /**
 443:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
 444:      *
 445:      * @param mixed $v string, integer (timestamp), or DateTime value.
 446:      *               Empty strings are treated as null.
 447:      * @return MessageVersion The current object (for fluent API support)
 448:      */
 449:     public function setUpdatedAt($v)
 450:     {
 451:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 452:         if ($this->updated_at !== null || $dt !== null) {
 453:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 454:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 455:             if ($currentDateAsString !== $newDateAsString) {
 456:                 $this->updated_at = $newDateAsString;
 457:                 $this->modifiedColumns[] = MessageVersionPeer::UPDATED_AT;
 458:             }
 459:         } // if either are not null
 460: 
 461: 
 462:         return $this;
 463:     } // setUpdatedAt()
 464: 
 465:     /**
 466:      * Set the value of [version] column.
 467:      *
 468:      * @param int $v new value
 469:      * @return MessageVersion The current object (for fluent API support)
 470:      */
 471:     public function setVersion($v)
 472:     {
 473:         if ($v !== null && is_numeric($v)) {
 474:             $v = (int) $v;
 475:         }
 476: 
 477:         if ($this->version !== $v) {
 478:             $this->version = $v;
 479:             $this->modifiedColumns[] = MessageVersionPeer::VERSION;
 480:         }
 481: 
 482: 
 483:         return $this;
 484:     } // setVersion()
 485: 
 486:     /**
 487:      * Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
 488:      *
 489:      * @param mixed $v string, integer (timestamp), or DateTime value.
 490:      *               Empty strings are treated as null.
 491:      * @return MessageVersion The current object (for fluent API support)
 492:      */
 493:     public function setVersionCreatedAt($v)
 494:     {
 495:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 496:         if ($this->version_created_at !== null || $dt !== null) {
 497:             $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 498:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 499:             if ($currentDateAsString !== $newDateAsString) {
 500:                 $this->version_created_at = $newDateAsString;
 501:                 $this->modifiedColumns[] = MessageVersionPeer::VERSION_CREATED_AT;
 502:             }
 503:         } // if either are not null
 504: 
 505: 
 506:         return $this;
 507:     } // setVersionCreatedAt()
 508: 
 509:     /**
 510:      * Set the value of [version_created_by] column.
 511:      *
 512:      * @param string $v new value
 513:      * @return MessageVersion The current object (for fluent API support)
 514:      */
 515:     public function setVersionCreatedBy($v)
 516:     {
 517:         if ($v !== null && is_numeric($v)) {
 518:             $v = (string) $v;
 519:         }
 520: 
 521:         if ($this->version_created_by !== $v) {
 522:             $this->version_created_by = $v;
 523:             $this->modifiedColumns[] = MessageVersionPeer::VERSION_CREATED_BY;
 524:         }
 525: 
 526: 
 527:         return $this;
 528:     } // setVersionCreatedBy()
 529: 
 530:     /**
 531:      * Indicates whether the columns in this object are only set to default values.
 532:      *
 533:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 534:      * modified _and_ has some values set which are non-default.
 535:      *
 536:      * @return boolean Whether the columns in this object are only been set with default values.
 537:      */
 538:     public function hasOnlyDefaultValues()
 539:     {
 540:             if ($this->version !== 0) {
 541:                 return false;
 542:             }
 543: 
 544:         // otherwise, everything was equal, so return true
 545:         return true;
 546:     } // hasOnlyDefaultValues()
 547: 
 548:     /**
 549:      * Hydrates (populates) the object variables with values from the database resultset.
 550:      *
 551:      * An offset (0-based "start column") is specified so that objects can be hydrated
 552:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 553:      * for results of JOIN queries where the resultset row includes columns from two or
 554:      * more tables.
 555:      *
 556:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 557:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 558:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 559:      * @return int             next starting column
 560:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 561:      */
 562:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 563:     {
 564:         try {
 565: 
 566:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 567:             $this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
 568:             $this->secured = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
 569:             $this->ref = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 570:             $this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 571:             $this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
 572:             $this->version = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
 573:             $this->version_created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
 574:             $this->version_created_by = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
 575:             $this->resetModified();
 576: 
 577:             $this->setNew(false);
 578: 
 579:             if ($rehydrate) {
 580:                 $this->ensureConsistency();
 581:             }
 582:             $this->postHydrate($row, $startcol, $rehydrate);
 583:             return $startcol + 9; // 9 = MessageVersionPeer::NUM_HYDRATE_COLUMNS.
 584: 
 585:         } catch (Exception $e) {
 586:             throw new PropelException("Error populating MessageVersion object", $e);
 587:         }
 588:     }
 589: 
 590:     /**
 591:      * Checks and repairs the internal consistency of the object.
 592:      *
 593:      * This method is executed after an already-instantiated object is re-hydrated
 594:      * from the database.  It exists to check any foreign keys to make sure that
 595:      * the objects related to the current object are correct based on foreign key.
 596:      *
 597:      * You can override this method in the stub class, but you should always invoke
 598:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 599:      * in case your model changes.
 600:      *
 601:      * @throws PropelException
 602:      */
 603:     public function ensureConsistency()
 604:     {
 605: 
 606:         if ($this->aMessage !== null && $this->id !== $this->aMessage->getId()) {
 607:             $this->aMessage = null;
 608:         }
 609:     } // ensureConsistency
 610: 
 611:     /**
 612:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 613:      *
 614:      * This will only work if the object has been saved and has a valid primary key set.
 615:      *
 616:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 617:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 618:      * @return void
 619:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 620:      */
 621:     public function reload($deep = false, PropelPDO $con = null)
 622:     {
 623:         if ($this->isDeleted()) {
 624:             throw new PropelException("Cannot reload a deleted object.");
 625:         }
 626: 
 627:         if ($this->isNew()) {
 628:             throw new PropelException("Cannot reload an unsaved object.");
 629:         }
 630: 
 631:         if ($con === null) {
 632:             $con = Propel::getConnection(MessageVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 633:         }
 634: 
 635:         // We don't need to alter the object instance pool; we're just modifying this instance
 636:         // already in the pool.
 637: 
 638:         $stmt = MessageVersionPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 639:         $row = $stmt->fetch(PDO::FETCH_NUM);
 640:         $stmt->closeCursor();
 641:         if (!$row) {
 642:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 643:         }
 644:         $this->hydrate($row, 0, true); // rehydrate
 645: 
 646:         if ($deep) {  // also de-associate any related objects?
 647: 
 648:             $this->aMessage = null;
 649:         } // if (deep)
 650:     }
 651: 
 652:     /**
 653:      * Removes this object from datastore and sets delete attribute.
 654:      *
 655:      * @param PropelPDO $con
 656:      * @return void
 657:      * @throws PropelException
 658:      * @throws Exception
 659:      * @see        BaseObject::setDeleted()
 660:      * @see        BaseObject::isDeleted()
 661:      */
 662:     public function delete(PropelPDO $con = null)
 663:     {
 664:         if ($this->isDeleted()) {
 665:             throw new PropelException("This object has already been deleted.");
 666:         }
 667: 
 668:         if ($con === null) {
 669:             $con = Propel::getConnection(MessageVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 670:         }
 671: 
 672:         $con->beginTransaction();
 673:         try {
 674:             $deleteQuery = MessageVersionQuery::create()
 675:                 ->filterByPrimaryKey($this->getPrimaryKey());
 676:             $ret = $this->preDelete($con);
 677:             if ($ret) {
 678:                 $deleteQuery->delete($con);
 679:                 $this->postDelete($con);
 680:                 $con->commit();
 681:                 $this->setDeleted(true);
 682:             } else {
 683:                 $con->commit();
 684:             }
 685:         } catch (Exception $e) {
 686:             $con->rollBack();
 687:             throw $e;
 688:         }
 689:     }
 690: 
 691:     /**
 692:      * Persists this object to the database.
 693:      *
 694:      * If the object is new, it inserts it; otherwise an update is performed.
 695:      * All modified related objects will also be persisted in the doSave()
 696:      * method.  This method wraps all precipitate database operations in a
 697:      * single transaction.
 698:      *
 699:      * @param PropelPDO $con
 700:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 701:      * @throws PropelException
 702:      * @throws Exception
 703:      * @see        doSave()
 704:      */
 705:     public function save(PropelPDO $con = null)
 706:     {
 707:         if ($this->isDeleted()) {
 708:             throw new PropelException("You cannot save an object that has been deleted.");
 709:         }
 710: 
 711:         if ($con === null) {
 712:             $con = Propel::getConnection(MessageVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 713:         }
 714: 
 715:         $con->beginTransaction();
 716:         $isInsert = $this->isNew();
 717:         try {
 718:             $ret = $this->preSave($con);
 719:             if ($isInsert) {
 720:                 $ret = $ret && $this->preInsert($con);
 721:             } else {
 722:                 $ret = $ret && $this->preUpdate($con);
 723:             }
 724:             if ($ret) {
 725:                 $affectedRows = $this->doSave($con);
 726:                 if ($isInsert) {
 727:                     $this->postInsert($con);
 728:                 } else {
 729:                     $this->postUpdate($con);
 730:                 }
 731:                 $this->postSave($con);
 732:                 MessageVersionPeer::addInstanceToPool($this);
 733:             } else {
 734:                 $affectedRows = 0;
 735:             }
 736:             $con->commit();
 737: 
 738:             return $affectedRows;
 739:         } catch (Exception $e) {
 740:             $con->rollBack();
 741:             throw $e;
 742:         }
 743:     }
 744: 
 745:     /**
 746:      * Performs the work of inserting or updating the row in the database.
 747:      *
 748:      * If the object is new, it inserts it; otherwise an update is performed.
 749:      * All related objects are also updated in this method.
 750:      *
 751:      * @param PropelPDO $con
 752:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 753:      * @throws PropelException
 754:      * @see        save()
 755:      */
 756:     protected function doSave(PropelPDO $con)
 757:     {
 758:         $affectedRows = 0; // initialize var to track total num of affected rows
 759:         if (!$this->alreadyInSave) {
 760:             $this->alreadyInSave = true;
 761: 
 762:             // We call the save method on the following object(s) if they
 763:             // were passed to this object by their coresponding set
 764:             // method.  This object relates to these object(s) by a
 765:             // foreign key reference.
 766: 
 767:             if ($this->aMessage !== null) {
 768:                 if ($this->aMessage->isModified() || $this->aMessage->isNew()) {
 769:                     $affectedRows += $this->aMessage->save($con);
 770:                 }
 771:                 $this->setMessage($this->aMessage);
 772:             }
 773: 
 774:             if ($this->isNew() || $this->isModified()) {
 775:                 // persist changes
 776:                 if ($this->isNew()) {
 777:                     $this->doInsert($con);
 778:                 } else {
 779:                     $this->doUpdate($con);
 780:                 }
 781:                 $affectedRows += 1;
 782:                 $this->resetModified();
 783:             }
 784: 
 785:             $this->alreadyInSave = false;
 786: 
 787:         }
 788: 
 789:         return $affectedRows;
 790:     } // doSave()
 791: 
 792:     /**
 793:      * Insert the row in the database.
 794:      *
 795:      * @param PropelPDO $con
 796:      *
 797:      * @throws PropelException
 798:      * @see        doSave()
 799:      */
 800:     protected function doInsert(PropelPDO $con)
 801:     {
 802:         $modifiedColumns = array();
 803:         $index = 0;
 804: 
 805: 
 806:          // check the columns in natural order for more readable SQL queries
 807:         if ($this->isColumnModified(MessageVersionPeer::ID)) {
 808:             $modifiedColumns[':p' . $index++]  = '`id`';
 809:         }
 810:         if ($this->isColumnModified(MessageVersionPeer::CODE)) {
 811:             $modifiedColumns[':p' . $index++]  = '`code`';
 812:         }
 813:         if ($this->isColumnModified(MessageVersionPeer::SECURED)) {
 814:             $modifiedColumns[':p' . $index++]  = '`secured`';
 815:         }
 816:         if ($this->isColumnModified(MessageVersionPeer::REF)) {
 817:             $modifiedColumns[':p' . $index++]  = '`ref`';
 818:         }
 819:         if ($this->isColumnModified(MessageVersionPeer::CREATED_AT)) {
 820:             $modifiedColumns[':p' . $index++]  = '`created_at`';
 821:         }
 822:         if ($this->isColumnModified(MessageVersionPeer::UPDATED_AT)) {
 823:             $modifiedColumns[':p' . $index++]  = '`updated_at`';
 824:         }
 825:         if ($this->isColumnModified(MessageVersionPeer::VERSION)) {
 826:             $modifiedColumns[':p' . $index++]  = '`version`';
 827:         }
 828:         if ($this->isColumnModified(MessageVersionPeer::VERSION_CREATED_AT)) {
 829:             $modifiedColumns[':p' . $index++]  = '`version_created_at`';
 830:         }
 831:         if ($this->isColumnModified(MessageVersionPeer::VERSION_CREATED_BY)) {
 832:             $modifiedColumns[':p' . $index++]  = '`version_created_by`';
 833:         }
 834: 
 835:         $sql = sprintf(
 836:             'INSERT INTO `message_version` (%s) VALUES (%s)',
 837:             implode(', ', $modifiedColumns),
 838:             implode(', ', array_keys($modifiedColumns))
 839:         );
 840: 
 841:         try {
 842:             $stmt = $con->prepare($sql);
 843:             foreach ($modifiedColumns as $identifier => $columnName) {
 844:                 switch ($columnName) {
 845:                     case '`id`':
 846:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
 847:                         break;
 848:                     case '`code`':
 849:                         $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
 850:                         break;
 851:                     case '`secured`':
 852:                         $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT);
 853:                         break;
 854:                     case '`ref`':
 855:                         $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
 856:                         break;
 857:                     case '`created_at`':
 858:                         $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
 859:                         break;
 860:                     case '`updated_at`':
 861:                         $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
 862:                         break;
 863:                     case '`version`':
 864:                         $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
 865:                         break;
 866:                     case '`version_created_at`':
 867:                         $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
 868:                         break;
 869:                     case '`version_created_by`':
 870:                         $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
 871:                         break;
 872:                 }
 873:             }
 874:             $stmt->execute();
 875:         } catch (Exception $e) {
 876:             Propel::log($e->getMessage(), Propel::LOG_ERR);
 877:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
 878:         }
 879: 
 880:         $this->setNew(false);
 881:     }
 882: 
 883:     /**
 884:      * Update the row in the database.
 885:      *
 886:      * @param PropelPDO $con
 887:      *
 888:      * @see        doSave()
 889:      */
 890:     protected function doUpdate(PropelPDO $con)
 891:     {
 892:         $selectCriteria = $this->buildPkeyCriteria();
 893:         $valuesCriteria = $this->buildCriteria();
 894:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
 895:     }
 896: 
 897:     /**
 898:      * Array of ValidationFailed objects.
 899:      * @var        array ValidationFailed[]
 900:      */
 901:     protected $validationFailures = array();
 902: 
 903:     /**
 904:      * Gets any ValidationFailed objects that resulted from last call to validate().
 905:      *
 906:      *
 907:      * @return array ValidationFailed[]
 908:      * @see        validate()
 909:      */
 910:     public function getValidationFailures()
 911:     {
 912:         return $this->validationFailures;
 913:     }
 914: 
 915:     /**
 916:      * Validates the objects modified field values and all objects related to this table.
 917:      *
 918:      * If $columns is either a column name or an array of column names
 919:      * only those columns are validated.
 920:      *
 921:      * @param mixed $columns Column name or an array of column names.
 922:      * @return boolean Whether all columns pass validation.
 923:      * @see        doValidate()
 924:      * @see        getValidationFailures()
 925:      */
 926:     public function validate($columns = null)
 927:     {
 928:         $res = $this->doValidate($columns);
 929:         if ($res === true) {
 930:             $this->validationFailures = array();
 931: 
 932:             return true;
 933:         }
 934: 
 935:         $this->validationFailures = $res;
 936: 
 937:         return false;
 938:     }
 939: 
 940:     /**
 941:      * This function performs the validation work for complex object models.
 942:      *
 943:      * In addition to checking the current object, all related objects will
 944:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
 945:      * an aggreagated array of ValidationFailed objects will be returned.
 946:      *
 947:      * @param array $columns Array of column names to validate.
 948:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
 949:      */
 950:     protected function doValidate($columns = null)
 951:     {
 952:         if (!$this->alreadyInValidation) {
 953:             $this->alreadyInValidation = true;
 954:             $retval = null;
 955: 
 956:             $failureMap = array();
 957: 
 958: 
 959:             // We call the validate method on the following object(s) if they
 960:             // were passed to this object by their coresponding set
 961:             // method.  This object relates to these object(s) by a
 962:             // foreign key reference.
 963: 
 964:             if ($this->aMessage !== null) {
 965:                 if (!$this->aMessage->validate($columns)) {
 966:                     $failureMap = array_merge($failureMap, $this->aMessage->getValidationFailures());
 967:                 }
 968:             }
 969: 
 970: 
 971:             if (($retval = MessageVersionPeer::doValidate($this, $columns)) !== true) {
 972:                 $failureMap = array_merge($failureMap, $retval);
 973:             }
 974: 
 975: 
 976: 
 977:             $this->alreadyInValidation = false;
 978:         }
 979: 
 980:         return (!empty($failureMap) ? $failureMap : true);
 981:     }
 982: 
 983:     /**
 984:      * Retrieves a field from the object by name passed in as a string.
 985:      *
 986:      * @param string $name name
 987:      * @param string $type The type of fieldname the $name is of:
 988:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 989:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 990:      *               Defaults to BasePeer::TYPE_PHPNAME
 991:      * @return mixed Value of field.
 992:      */
 993:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
 994:     {
 995:         $pos = MessageVersionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 996:         $field = $this->getByPosition($pos);
 997: 
 998:         return $field;
 999:     }
1000: 
1001:     /**
1002:      * Retrieves a field from the object by Position as specified in the xml schema.
1003:      * Zero-based.
1004:      *
1005:      * @param int $pos position in xml schema
1006:      * @return mixed Value of field at $pos
1007:      */
1008:     public function getByPosition($pos)
1009:     {
1010:         switch ($pos) {
1011:             case 0:
1012:                 return $this->getId();
1013:                 break;
1014:             case 1:
1015:                 return $this->getCode();
1016:                 break;
1017:             case 2:
1018:                 return $this->getSecured();
1019:                 break;
1020:             case 3:
1021:                 return $this->getRef();
1022:                 break;
1023:             case 4:
1024:                 return $this->getCreatedAt();
1025:                 break;
1026:             case 5:
1027:                 return $this->getUpdatedAt();
1028:                 break;
1029:             case 6:
1030:                 return $this->getVersion();
1031:                 break;
1032:             case 7:
1033:                 return $this->getVersionCreatedAt();
1034:                 break;
1035:             case 8:
1036:                 return $this->getVersionCreatedBy();
1037:                 break;
1038:             default:
1039:                 return null;
1040:                 break;
1041:         } // switch()
1042:     }
1043: 
1044:     /**
1045:      * Exports the object as an array.
1046:      *
1047:      * You can specify the key type of the array by passing one of the class
1048:      * type constants.
1049:      *
1050:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1051:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1052:      *                    Defaults to BasePeer::TYPE_PHPNAME.
1053:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
1054:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1055:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1056:      *
1057:      * @return array an associative array containing the field names (as keys) and field values
1058:      */
1059:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1060:     {
1061:         if (isset($alreadyDumpedObjects['MessageVersion'][serialize($this->getPrimaryKey())])) {
1062:             return '*RECURSION*';
1063:         }
1064:         $alreadyDumpedObjects['MessageVersion'][serialize($this->getPrimaryKey())] = true;
1065:         $keys = MessageVersionPeer::getFieldNames($keyType);
1066:         $result = array(
1067:             $keys[0] => $this->getId(),
1068:             $keys[1] => $this->getCode(),
1069:             $keys[2] => $this->getSecured(),
1070:             $keys[3] => $this->getRef(),
1071:             $keys[4] => $this->getCreatedAt(),
1072:             $keys[5] => $this->getUpdatedAt(),
1073:             $keys[6] => $this->getVersion(),
1074:             $keys[7] => $this->getVersionCreatedAt(),
1075:             $keys[8] => $this->getVersionCreatedBy(),
1076:         );
1077:         if ($includeForeignObjects) {
1078:             if (null !== $this->aMessage) {
1079:                 $result['Message'] = $this->aMessage->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1080:             }
1081:         }
1082: 
1083:         return $result;
1084:     }
1085: 
1086:     /**
1087:      * Sets a field from the object by name passed in as a string.
1088:      *
1089:      * @param string $name peer name
1090:      * @param mixed $value field value
1091:      * @param string $type The type of fieldname the $name is of:
1092:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1093:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1094:      *                     Defaults to BasePeer::TYPE_PHPNAME
1095:      * @return void
1096:      */
1097:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1098:     {
1099:         $pos = MessageVersionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1100: 
1101:         $this->setByPosition($pos, $value);
1102:     }
1103: 
1104:     /**
1105:      * Sets a field from the object by Position as specified in the xml schema.
1106:      * Zero-based.
1107:      *
1108:      * @param int $pos position in xml schema
1109:      * @param mixed $value field value
1110:      * @return void
1111:      */
1112:     public function setByPosition($pos, $value)
1113:     {
1114:         switch ($pos) {
1115:             case 0:
1116:                 $this->setId($value);
1117:                 break;
1118:             case 1:
1119:                 $this->setCode($value);
1120:                 break;
1121:             case 2:
1122:                 $this->setSecured($value);
1123:                 break;
1124:             case 3:
1125:                 $this->setRef($value);
1126:                 break;
1127:             case 4:
1128:                 $this->setCreatedAt($value);
1129:                 break;
1130:             case 5:
1131:                 $this->setUpdatedAt($value);
1132:                 break;
1133:             case 6:
1134:                 $this->setVersion($value);
1135:                 break;
1136:             case 7:
1137:                 $this->setVersionCreatedAt($value);
1138:                 break;
1139:             case 8:
1140:                 $this->setVersionCreatedBy($value);
1141:                 break;
1142:         } // switch()
1143:     }
1144: 
1145:     /**
1146:      * Populates the object using an array.
1147:      *
1148:      * This is particularly useful when populating an object from one of the
1149:      * request arrays (e.g. $_POST).  This method goes through the column
1150:      * names, checking to see whether a matching key exists in populated
1151:      * array. If so the setByName() method is called for that column.
1152:      *
1153:      * You can specify the key type of the array by additionally passing one
1154:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1155:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1156:      * The default key type is the column's BasePeer::TYPE_PHPNAME
1157:      *
1158:      * @param array  $arr     An array to populate the object from.
1159:      * @param string $keyType The type of keys the array uses.
1160:      * @return void
1161:      */
1162:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1163:     {
1164:         $keys = MessageVersionPeer::getFieldNames($keyType);
1165: 
1166:         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
1167:         if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
1168:         if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]);
1169:         if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]);
1170:         if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
1171:         if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
1172:         if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]);
1173:         if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]);
1174:         if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]);
1175:     }
1176: 
1177:     /**
1178:      * Build a Criteria object containing the values of all modified columns in this object.
1179:      *
1180:      * @return Criteria The Criteria object containing all modified values.
1181:      */
1182:     public function buildCriteria()
1183:     {
1184:         $criteria = new Criteria(MessageVersionPeer::DATABASE_NAME);
1185: 
1186:         if ($this->isColumnModified(MessageVersionPeer::ID)) $criteria->add(MessageVersionPeer::ID, $this->id);
1187:         if ($this->isColumnModified(MessageVersionPeer::CODE)) $criteria->add(MessageVersionPeer::CODE, $this->code);
1188:         if ($this->isColumnModified(MessageVersionPeer::SECURED)) $criteria->add(MessageVersionPeer::SECURED, $this->secured);
1189:         if ($this->isColumnModified(MessageVersionPeer::REF)) $criteria->add(MessageVersionPeer::REF, $this->ref);
1190:         if ($this->isColumnModified(MessageVersionPeer::CREATED_AT)) $criteria->add(MessageVersionPeer::CREATED_AT, $this->created_at);
1191:         if ($this->isColumnModified(MessageVersionPeer::UPDATED_AT)) $criteria->add(MessageVersionPeer::UPDATED_AT, $this->updated_at);
1192:         if ($this->isColumnModified(MessageVersionPeer::VERSION)) $criteria->add(MessageVersionPeer::VERSION, $this->version);
1193:         if ($this->isColumnModified(MessageVersionPeer::VERSION_CREATED_AT)) $criteria->add(MessageVersionPeer::VERSION_CREATED_AT, $this->version_created_at);
1194:         if ($this->isColumnModified(MessageVersionPeer::VERSION_CREATED_BY)) $criteria->add(MessageVersionPeer::VERSION_CREATED_BY, $this->version_created_by);
1195: 
1196:         return $criteria;
1197:     }
1198: 
1199:     /**
1200:      * Builds a Criteria object containing the primary key for this object.
1201:      *
1202:      * Unlike buildCriteria() this method includes the primary key values regardless
1203:      * of whether or not they have been modified.
1204:      *
1205:      * @return Criteria The Criteria object containing value(s) for primary key(s).
1206:      */
1207:     public function buildPkeyCriteria()
1208:     {
1209:         $criteria = new Criteria(MessageVersionPeer::DATABASE_NAME);
1210:         $criteria->add(MessageVersionPeer::ID, $this->id);
1211:         $criteria->add(MessageVersionPeer::VERSION, $this->version);
1212: 
1213:         return $criteria;
1214:     }
1215: 
1216:     /**
1217:      * Returns the composite primary key for this object.
1218:      * The array elements will be in same order as specified in XML.
1219:      * @return array
1220:      */
1221:     public function getPrimaryKey()
1222:     {
1223:         $pks = array();
1224:         $pks[0] = $this->getId();
1225:         $pks[1] = $this->getVersion();
1226: 
1227:         return $pks;
1228:     }
1229: 
1230:     /**
1231:      * Set the [composite] primary key.
1232:      *
1233:      * @param array $keys The elements of the composite key (order must match the order in XML file).
1234:      * @return void
1235:      */
1236:     public function setPrimaryKey($keys)
1237:     {
1238:         $this->setId($keys[0]);
1239:         $this->setVersion($keys[1]);
1240:     }
1241: 
1242:     /**
1243:      * Returns true if the primary key for this object is null.
1244:      * @return boolean
1245:      */
1246:     public function isPrimaryKeyNull()
1247:     {
1248: 
1249:         return (null === $this->getId()) && (null === $this->getVersion());
1250:     }
1251: 
1252:     /**
1253:      * Sets contents of passed object to values from current object.
1254:      *
1255:      * If desired, this method can also make copies of all associated (fkey referrers)
1256:      * objects.
1257:      *
1258:      * @param object $copyObj An object of MessageVersion (or compatible) type.
1259:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1260:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1261:      * @throws PropelException
1262:      */
1263:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1264:     {
1265:         $copyObj->setId($this->getId());
1266:         $copyObj->setCode($this->getCode());
1267:         $copyObj->setSecured($this->getSecured());
1268:         $copyObj->setRef($this->getRef());
1269:         $copyObj->setCreatedAt($this->getCreatedAt());
1270:         $copyObj->setUpdatedAt($this->getUpdatedAt());
1271:         $copyObj->setVersion($this->getVersion());
1272:         $copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
1273:         $copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
1274: 
1275:         if ($deepCopy && !$this->startCopy) {
1276:             // important: temporarily setNew(false) because this affects the behavior of
1277:             // the getter/setter methods for fkey referrer objects.
1278:             $copyObj->setNew(false);
1279:             // store object hash to prevent cycle
1280:             $this->startCopy = true;
1281: 
1282:             //unflag object copy
1283:             $this->startCopy = false;
1284:         } // if ($deepCopy)
1285: 
1286:         if ($makeNew) {
1287:             $copyObj->setNew(true);
1288:         }
1289:     }
1290: 
1291:     /**
1292:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1293:      * It creates a new object filling in the simple attributes, but skipping any primary
1294:      * keys that are defined for the table.
1295:      *
1296:      * If desired, this method can also make copies of all associated (fkey referrers)
1297:      * objects.
1298:      *
1299:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1300:      * @return MessageVersion Clone of current object.
1301:      * @throws PropelException
1302:      */
1303:     public function copy($deepCopy = false)
1304:     {
1305:         // we use get_class(), because this might be a subclass
1306:         $clazz = get_class($this);
1307:         $copyObj = new $clazz();
1308:         $this->copyInto($copyObj, $deepCopy);
1309: 
1310:         return $copyObj;
1311:     }
1312: 
1313:     /**
1314:      * Returns a peer instance associated with this om.
1315:      *
1316:      * Since Peer classes are not to have any instance attributes, this method returns the
1317:      * same instance for all member of this class. The method could therefore
1318:      * be static, but this would prevent one from overriding the behavior.
1319:      *
1320:      * @return MessageVersionPeer
1321:      */
1322:     public function getPeer()
1323:     {
1324:         if (self::$peer === null) {
1325:             self::$peer = new MessageVersionPeer();
1326:         }
1327: 
1328:         return self::$peer;
1329:     }
1330: 
1331:     /**
1332:      * Declares an association between this object and a Message object.
1333:      *
1334:      * @param             Message $v
1335:      * @return MessageVersion The current object (for fluent API support)
1336:      * @throws PropelException
1337:      */
1338:     public function setMessage(Message $v = null)
1339:     {
1340:         if ($v === null) {
1341:             $this->setId(NULL);
1342:         } else {
1343:             $this->setId($v->getId());
1344:         }
1345: 
1346:         $this->aMessage = $v;
1347: 
1348:         // Add binding for other direction of this n:n relationship.
1349:         // If this object has already been added to the Message object, it will not be re-added.
1350:         if ($v !== null) {
1351:             $v->addMessageVersion($this);
1352:         }
1353: 
1354: 
1355:         return $this;
1356:     }
1357: 
1358: 
1359:     /**
1360:      * Get the associated Message object
1361:      *
1362:      * @param PropelPDO $con Optional Connection object.
1363:      * @param $doQuery Executes a query to get the object if required
1364:      * @return Message The associated Message object.
1365:      * @throws PropelException
1366:      */
1367:     public function getMessage(PropelPDO $con = null, $doQuery = true)
1368:     {
1369:         if ($this->aMessage === null && ($this->id !== null) && $doQuery) {
1370:             $this->aMessage = MessageQuery::create()->findPk($this->id, $con);
1371:             /* The following can be used additionally to
1372:                 guarantee the related object contains a reference
1373:                 to this object.  This level of coupling may, however, be
1374:                 undesirable since it could result in an only partially populated collection
1375:                 in the referenced object.
1376:                 $this->aMessage->addMessageVersions($this);
1377:              */
1378:         }
1379: 
1380:         return $this->aMessage;
1381:     }
1382: 
1383:     /**
1384:      * Clears the current object and sets all attributes to their default values
1385:      */
1386:     public function clear()
1387:     {
1388:         $this->id = null;
1389:         $this->code = null;
1390:         $this->secured = null;
1391:         $this->ref = null;
1392:         $this->created_at = null;
1393:         $this->updated_at = null;
1394:         $this->version = null;
1395:         $this->version_created_at = null;
1396:         $this->version_created_by = null;
1397:         $this->alreadyInSave = false;
1398:         $this->alreadyInValidation = false;
1399:         $this->alreadyInClearAllReferencesDeep = false;
1400:         $this->clearAllReferences();
1401:         $this->applyDefaultValues();
1402:         $this->resetModified();
1403:         $this->setNew(true);
1404:         $this->setDeleted(false);
1405:     }
1406: 
1407:     /**
1408:      * Resets all references to other model objects or collections of model objects.
1409:      *
1410:      * This method is a user-space workaround for PHP's inability to garbage collect
1411:      * objects with circular references (even in PHP 5.3). This is currently necessary
1412:      * when using Propel in certain daemon or large-volumne/high-memory operations.
1413:      *
1414:      * @param boolean $deep Whether to also clear the references on all referrer objects.
1415:      */
1416:     public function clearAllReferences($deep = false)
1417:     {
1418:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1419:             $this->alreadyInClearAllReferencesDeep = true;
1420:             if ($this->aMessage instanceof Persistent) {
1421:               $this->aMessage->clearAllReferences($deep);
1422:             }
1423: 
1424:             $this->alreadyInClearAllReferencesDeep = false;
1425:         } // if ($deep)
1426: 
1427:         $this->aMessage = null;
1428:     }
1429: 
1430:     /**
1431:      * return the string representation of this object
1432:      *
1433:      * @return string
1434:      */
1435:     public function __toString()
1436:     {
1437:         return (string) $this->exportTo(MessageVersionPeer::DEFAULT_STRING_FORMAT);
1438:     }
1439: 
1440:     /**
1441:      * return true is the object is in saving state
1442:      *
1443:      * @return boolean
1444:      */
1445:     public function isAlreadyInSave()
1446:     {
1447:         return $this->alreadyInSave;
1448:     }
1449: 
1450: }
1451: 
thelia API documentation generated by ApiGen 2.8.0