Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModule
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseModuleQuery
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • 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 \PropelCollection;
  14: use \PropelDateTime;
  15: use \PropelException;
  16: use \PropelObjectCollection;
  17: use \PropelPDO;
  18: use Thelia\Model\Order;
  19: use Thelia\Model\OrderQuery;
  20: use Thelia\Model\OrderStatus;
  21: use Thelia\Model\OrderStatusI18n;
  22: use Thelia\Model\OrderStatusI18nQuery;
  23: use Thelia\Model\OrderStatusPeer;
  24: use Thelia\Model\OrderStatusQuery;
  25: 
  26: /**
  27:  * Base class that represents a row from the 'order_status' table.
  28:  *
  29:  *
  30:  *
  31:  * @package    propel.generator.Thelia.Model.om
  32:  */
  33: abstract class BaseOrderStatus extends BaseObject implements Persistent
  34: {
  35:     /**
  36:      * Peer class name
  37:      */
  38:     const PEER = 'Thelia\\Model\\OrderStatusPeer';
  39: 
  40:     /**
  41:      * The Peer class.
  42:      * Instance provides a convenient way of calling static methods on a class
  43:      * that calling code may not be able to identify.
  44:      * @var        OrderStatusPeer
  45:      */
  46:     protected static $peer;
  47: 
  48:     /**
  49:      * The flag var to prevent infinit loop in deep copy
  50:      * @var       boolean
  51:      */
  52:     protected $startCopy = false;
  53: 
  54:     /**
  55:      * The value for the id field.
  56:      * @var        int
  57:      */
  58:     protected $id;
  59: 
  60:     /**
  61:      * The value for the code field.
  62:      * @var        string
  63:      */
  64:     protected $code;
  65: 
  66:     /**
  67:      * The value for the created_at field.
  68:      * @var        string
  69:      */
  70:     protected $created_at;
  71: 
  72:     /**
  73:      * The value for the updated_at field.
  74:      * @var        string
  75:      */
  76:     protected $updated_at;
  77: 
  78:     /**
  79:      * @var        PropelObjectCollection|Order[] Collection to store aggregation of Order objects.
  80:      */
  81:     protected $collOrders;
  82:     protected $collOrdersPartial;
  83: 
  84:     /**
  85:      * @var        PropelObjectCollection|OrderStatusI18n[] Collection to store aggregation of OrderStatusI18n objects.
  86:      */
  87:     protected $collOrderStatusI18ns;
  88:     protected $collOrderStatusI18nsPartial;
  89: 
  90:     /**
  91:      * Flag to prevent endless save loop, if this object is referenced
  92:      * by another object which falls in this transaction.
  93:      * @var        boolean
  94:      */
  95:     protected $alreadyInSave = false;
  96: 
  97:     /**
  98:      * Flag to prevent endless validation loop, if this object is referenced
  99:      * by another object which falls in this transaction.
 100:      * @var        boolean
 101:      */
 102:     protected $alreadyInValidation = false;
 103: 
 104:     /**
 105:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
 106:      * @var        boolean
 107:      */
 108:     protected $alreadyInClearAllReferencesDeep = false;
 109: 
 110:     // i18n behavior
 111: 
 112:     /**
 113:      * Current locale
 114:      * @var        string
 115:      */
 116:     protected $currentLocale = 'en_US';
 117: 
 118:     /**
 119:      * Current translation objects
 120:      * @var        array[OrderStatusI18n]
 121:      */
 122:     protected $currentTranslations;
 123: 
 124:     /**
 125:      * An array of objects scheduled for deletion.
 126:      * @var     PropelObjectCollection
 127:      */
 128:     protected $ordersScheduledForDeletion = null;
 129: 
 130:     /**
 131:      * An array of objects scheduled for deletion.
 132:      * @var     PropelObjectCollection
 133:      */
 134:     protected $orderStatusI18nsScheduledForDeletion = null;
 135: 
 136:     /**
 137:      * Get the [id] column value.
 138:      *
 139:      * @return int
 140:      */
 141:     public function getId()
 142:     {
 143:         return $this->id;
 144:     }
 145: 
 146:     /**
 147:      * Get the [code] column value.
 148:      *
 149:      * @return string
 150:      */
 151:     public function getCode()
 152:     {
 153:         return $this->code;
 154:     }
 155: 
 156:     /**
 157:      * Get the [optionally formatted] temporal [created_at] column value.
 158:      *
 159:      *
 160:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 161:      *               If format is null, then the raw DateTime object will be returned.
 162:      * @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
 163:      * @throws PropelException - if unable to parse/validate the date/time value.
 164:      */
 165:     public function getCreatedAt($format = 'Y-m-d H:i:s')
 166:     {
 167:         if ($this->created_at === null) {
 168:             return null;
 169:         }
 170: 
 171:         if ($this->created_at === '0000-00-00 00:00:00') {
 172:             // while technically this is not a default value of null,
 173:             // this seems to be closest in meaning.
 174:             return null;
 175:         }
 176: 
 177:         try {
 178:             $dt = new DateTime($this->created_at);
 179:         } catch (Exception $x) {
 180:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
 181:         }
 182: 
 183:         if ($format === null) {
 184:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 185:             return $dt;
 186:         }
 187: 
 188:         if (strpos($format, '%') !== false) {
 189:             return strftime($format, $dt->format('U'));
 190:         }
 191: 
 192:         return $dt->format($format);
 193: 
 194:     }
 195: 
 196:     /**
 197:      * Get the [optionally formatted] temporal [updated_at] column value.
 198:      *
 199:      *
 200:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 201:      *               If format is null, then the raw DateTime object will be returned.
 202:      * @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
 203:      * @throws PropelException - if unable to parse/validate the date/time value.
 204:      */
 205:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
 206:     {
 207:         if ($this->updated_at === null) {
 208:             return null;
 209:         }
 210: 
 211:         if ($this->updated_at === '0000-00-00 00:00:00') {
 212:             // while technically this is not a default value of null,
 213:             // this seems to be closest in meaning.
 214:             return null;
 215:         }
 216: 
 217:         try {
 218:             $dt = new DateTime($this->updated_at);
 219:         } catch (Exception $x) {
 220:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
 221:         }
 222: 
 223:         if ($format === null) {
 224:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 225:             return $dt;
 226:         }
 227: 
 228:         if (strpos($format, '%') !== false) {
 229:             return strftime($format, $dt->format('U'));
 230:         }
 231: 
 232:         return $dt->format($format);
 233: 
 234:     }
 235: 
 236:     /**
 237:      * Set the value of [id] column.
 238:      *
 239:      * @param int $v new value
 240:      * @return OrderStatus The current object (for fluent API support)
 241:      */
 242:     public function setId($v)
 243:     {
 244:         if ($v !== null && is_numeric($v)) {
 245:             $v = (int) $v;
 246:         }
 247: 
 248:         if ($this->id !== $v) {
 249:             $this->id = $v;
 250:             $this->modifiedColumns[] = OrderStatusPeer::ID;
 251:         }
 252: 
 253: 
 254:         return $this;
 255:     } // setId()
 256: 
 257:     /**
 258:      * Set the value of [code] column.
 259:      *
 260:      * @param string $v new value
 261:      * @return OrderStatus The current object (for fluent API support)
 262:      */
 263:     public function setCode($v)
 264:     {
 265:         if ($v !== null && is_numeric($v)) {
 266:             $v = (string) $v;
 267:         }
 268: 
 269:         if ($this->code !== $v) {
 270:             $this->code = $v;
 271:             $this->modifiedColumns[] = OrderStatusPeer::CODE;
 272:         }
 273: 
 274: 
 275:         return $this;
 276:     } // setCode()
 277: 
 278:     /**
 279:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
 280:      *
 281:      * @param mixed $v string, integer (timestamp), or DateTime value.
 282:      *               Empty strings are treated as null.
 283:      * @return OrderStatus The current object (for fluent API support)
 284:      */
 285:     public function setCreatedAt($v)
 286:     {
 287:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 288:         if ($this->created_at !== null || $dt !== null) {
 289:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 290:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 291:             if ($currentDateAsString !== $newDateAsString) {
 292:                 $this->created_at = $newDateAsString;
 293:                 $this->modifiedColumns[] = OrderStatusPeer::CREATED_AT;
 294:             }
 295:         } // if either are not null
 296: 
 297: 
 298:         return $this;
 299:     } // setCreatedAt()
 300: 
 301:     /**
 302:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
 303:      *
 304:      * @param mixed $v string, integer (timestamp), or DateTime value.
 305:      *               Empty strings are treated as null.
 306:      * @return OrderStatus The current object (for fluent API support)
 307:      */
 308:     public function setUpdatedAt($v)
 309:     {
 310:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 311:         if ($this->updated_at !== null || $dt !== null) {
 312:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 313:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 314:             if ($currentDateAsString !== $newDateAsString) {
 315:                 $this->updated_at = $newDateAsString;
 316:                 $this->modifiedColumns[] = OrderStatusPeer::UPDATED_AT;
 317:             }
 318:         } // if either are not null
 319: 
 320: 
 321:         return $this;
 322:     } // setUpdatedAt()
 323: 
 324:     /**
 325:      * Indicates whether the columns in this object are only set to default values.
 326:      *
 327:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 328:      * modified _and_ has some values set which are non-default.
 329:      *
 330:      * @return boolean Whether the columns in this object are only been set with default values.
 331:      */
 332:     public function hasOnlyDefaultValues()
 333:     {
 334:         // otherwise, everything was equal, so return true
 335:         return true;
 336:     } // hasOnlyDefaultValues()
 337: 
 338:     /**
 339:      * Hydrates (populates) the object variables with values from the database resultset.
 340:      *
 341:      * An offset (0-based "start column") is specified so that objects can be hydrated
 342:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 343:      * for results of JOIN queries where the resultset row includes columns from two or
 344:      * more tables.
 345:      *
 346:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 347:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 348:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 349:      * @return int             next starting column
 350:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 351:      */
 352:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 353:     {
 354:         try {
 355: 
 356:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 357:             $this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
 358:             $this->created_at = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
 359:             $this->updated_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 360:             $this->resetModified();
 361: 
 362:             $this->setNew(false);
 363: 
 364:             if ($rehydrate) {
 365:                 $this->ensureConsistency();
 366:             }
 367:             $this->postHydrate($row, $startcol, $rehydrate);
 368:             return $startcol + 4; // 4 = OrderStatusPeer::NUM_HYDRATE_COLUMNS.
 369: 
 370:         } catch (Exception $e) {
 371:             throw new PropelException("Error populating OrderStatus object", $e);
 372:         }
 373:     }
 374: 
 375:     /**
 376:      * Checks and repairs the internal consistency of the object.
 377:      *
 378:      * This method is executed after an already-instantiated object is re-hydrated
 379:      * from the database.  It exists to check any foreign keys to make sure that
 380:      * the objects related to the current object are correct based on foreign key.
 381:      *
 382:      * You can override this method in the stub class, but you should always invoke
 383:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 384:      * in case your model changes.
 385:      *
 386:      * @throws PropelException
 387:      */
 388:     public function ensureConsistency()
 389:     {
 390: 
 391:     } // ensureConsistency
 392: 
 393:     /**
 394:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 395:      *
 396:      * This will only work if the object has been saved and has a valid primary key set.
 397:      *
 398:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 399:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 400:      * @return void
 401:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 402:      */
 403:     public function reload($deep = false, PropelPDO $con = null)
 404:     {
 405:         if ($this->isDeleted()) {
 406:             throw new PropelException("Cannot reload a deleted object.");
 407:         }
 408: 
 409:         if ($this->isNew()) {
 410:             throw new PropelException("Cannot reload an unsaved object.");
 411:         }
 412: 
 413:         if ($con === null) {
 414:             $con = Propel::getConnection(OrderStatusPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 415:         }
 416: 
 417:         // We don't need to alter the object instance pool; we're just modifying this instance
 418:         // already in the pool.
 419: 
 420:         $stmt = OrderStatusPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 421:         $row = $stmt->fetch(PDO::FETCH_NUM);
 422:         $stmt->closeCursor();
 423:         if (!$row) {
 424:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 425:         }
 426:         $this->hydrate($row, 0, true); // rehydrate
 427: 
 428:         if ($deep) {  // also de-associate any related objects?
 429: 
 430:             $this->collOrders = null;
 431: 
 432:             $this->collOrderStatusI18ns = null;
 433: 
 434:         } // if (deep)
 435:     }
 436: 
 437:     /**
 438:      * Removes this object from datastore and sets delete attribute.
 439:      *
 440:      * @param PropelPDO $con
 441:      * @return void
 442:      * @throws PropelException
 443:      * @throws Exception
 444:      * @see        BaseObject::setDeleted()
 445:      * @see        BaseObject::isDeleted()
 446:      */
 447:     public function delete(PropelPDO $con = null)
 448:     {
 449:         if ($this->isDeleted()) {
 450:             throw new PropelException("This object has already been deleted.");
 451:         }
 452: 
 453:         if ($con === null) {
 454:             $con = Propel::getConnection(OrderStatusPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 455:         }
 456: 
 457:         $con->beginTransaction();
 458:         try {
 459:             $deleteQuery = OrderStatusQuery::create()
 460:                 ->filterByPrimaryKey($this->getPrimaryKey());
 461:             $ret = $this->preDelete($con);
 462:             if ($ret) {
 463:                 $deleteQuery->delete($con);
 464:                 $this->postDelete($con);
 465:                 $con->commit();
 466:                 $this->setDeleted(true);
 467:             } else {
 468:                 $con->commit();
 469:             }
 470:         } catch (Exception $e) {
 471:             $con->rollBack();
 472:             throw $e;
 473:         }
 474:     }
 475: 
 476:     /**
 477:      * Persists this object to the database.
 478:      *
 479:      * If the object is new, it inserts it; otherwise an update is performed.
 480:      * All modified related objects will also be persisted in the doSave()
 481:      * method.  This method wraps all precipitate database operations in a
 482:      * single transaction.
 483:      *
 484:      * @param PropelPDO $con
 485:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 486:      * @throws PropelException
 487:      * @throws Exception
 488:      * @see        doSave()
 489:      */
 490:     public function save(PropelPDO $con = null)
 491:     {
 492:         if ($this->isDeleted()) {
 493:             throw new PropelException("You cannot save an object that has been deleted.");
 494:         }
 495: 
 496:         if ($con === null) {
 497:             $con = Propel::getConnection(OrderStatusPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 498:         }
 499: 
 500:         $con->beginTransaction();
 501:         $isInsert = $this->isNew();
 502:         try {
 503:             $ret = $this->preSave($con);
 504:             if ($isInsert) {
 505:                 $ret = $ret && $this->preInsert($con);
 506:                 // timestampable behavior
 507:                 if (!$this->isColumnModified(OrderStatusPeer::CREATED_AT)) {
 508:                     $this->setCreatedAt(time());
 509:                 }
 510:                 if (!$this->isColumnModified(OrderStatusPeer::UPDATED_AT)) {
 511:                     $this->setUpdatedAt(time());
 512:                 }
 513:             } else {
 514:                 $ret = $ret && $this->preUpdate($con);
 515:                 // timestampable behavior
 516:                 if ($this->isModified() && !$this->isColumnModified(OrderStatusPeer::UPDATED_AT)) {
 517:                     $this->setUpdatedAt(time());
 518:                 }
 519:             }
 520:             if ($ret) {
 521:                 $affectedRows = $this->doSave($con);
 522:                 if ($isInsert) {
 523:                     $this->postInsert($con);
 524:                 } else {
 525:                     $this->postUpdate($con);
 526:                 }
 527:                 $this->postSave($con);
 528:                 OrderStatusPeer::addInstanceToPool($this);
 529:             } else {
 530:                 $affectedRows = 0;
 531:             }
 532:             $con->commit();
 533: 
 534:             return $affectedRows;
 535:         } catch (Exception $e) {
 536:             $con->rollBack();
 537:             throw $e;
 538:         }
 539:     }
 540: 
 541:     /**
 542:      * Performs the work of inserting or updating the row in the database.
 543:      *
 544:      * If the object is new, it inserts it; otherwise an update is performed.
 545:      * All related objects are also updated in this method.
 546:      *
 547:      * @param PropelPDO $con
 548:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 549:      * @throws PropelException
 550:      * @see        save()
 551:      */
 552:     protected function doSave(PropelPDO $con)
 553:     {
 554:         $affectedRows = 0; // initialize var to track total num of affected rows
 555:         if (!$this->alreadyInSave) {
 556:             $this->alreadyInSave = true;
 557: 
 558:             if ($this->isNew() || $this->isModified()) {
 559:                 // persist changes
 560:                 if ($this->isNew()) {
 561:                     $this->doInsert($con);
 562:                 } else {
 563:                     $this->doUpdate($con);
 564:                 }
 565:                 $affectedRows += 1;
 566:                 $this->resetModified();
 567:             }
 568: 
 569:             if ($this->ordersScheduledForDeletion !== null) {
 570:                 if (!$this->ordersScheduledForDeletion->isEmpty()) {
 571:                     foreach ($this->ordersScheduledForDeletion as $order) {
 572:                         // need to save related object because we set the relation to null
 573:                         $order->save($con);
 574:                     }
 575:                     $this->ordersScheduledForDeletion = null;
 576:                 }
 577:             }
 578: 
 579:             if ($this->collOrders !== null) {
 580:                 foreach ($this->collOrders as $referrerFK) {
 581:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
 582:                         $affectedRows += $referrerFK->save($con);
 583:                     }
 584:                 }
 585:             }
 586: 
 587:             if ($this->orderStatusI18nsScheduledForDeletion !== null) {
 588:                 if (!$this->orderStatusI18nsScheduledForDeletion->isEmpty()) {
 589:                     OrderStatusI18nQuery::create()
 590:                         ->filterByPrimaryKeys($this->orderStatusI18nsScheduledForDeletion->getPrimaryKeys(false))
 591:                         ->delete($con);
 592:                     $this->orderStatusI18nsScheduledForDeletion = null;
 593:                 }
 594:             }
 595: 
 596:             if ($this->collOrderStatusI18ns !== null) {
 597:                 foreach ($this->collOrderStatusI18ns as $referrerFK) {
 598:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
 599:                         $affectedRows += $referrerFK->save($con);
 600:                     }
 601:                 }
 602:             }
 603: 
 604:             $this->alreadyInSave = false;
 605: 
 606:         }
 607: 
 608:         return $affectedRows;
 609:     } // doSave()
 610: 
 611:     /**
 612:      * Insert the row in the database.
 613:      *
 614:      * @param PropelPDO $con
 615:      *
 616:      * @throws PropelException
 617:      * @see        doSave()
 618:      */
 619:     protected function doInsert(PropelPDO $con)
 620:     {
 621:         $modifiedColumns = array();
 622:         $index = 0;
 623: 
 624:         $this->modifiedColumns[] = OrderStatusPeer::ID;
 625:         if (null !== $this->id) {
 626:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderStatusPeer::ID . ')');
 627:         }
 628: 
 629:          // check the columns in natural order for more readable SQL queries
 630:         if ($this->isColumnModified(OrderStatusPeer::ID)) {
 631:             $modifiedColumns[':p' . $index++]  = '`id`';
 632:         }
 633:         if ($this->isColumnModified(OrderStatusPeer::CODE)) {
 634:             $modifiedColumns[':p' . $index++]  = '`code`';
 635:         }
 636:         if ($this->isColumnModified(OrderStatusPeer::CREATED_AT)) {
 637:             $modifiedColumns[':p' . $index++]  = '`created_at`';
 638:         }
 639:         if ($this->isColumnModified(OrderStatusPeer::UPDATED_AT)) {
 640:             $modifiedColumns[':p' . $index++]  = '`updated_at`';
 641:         }
 642: 
 643:         $sql = sprintf(
 644:             'INSERT INTO `order_status` (%s) VALUES (%s)',
 645:             implode(', ', $modifiedColumns),
 646:             implode(', ', array_keys($modifiedColumns))
 647:         );
 648: 
 649:         try {
 650:             $stmt = $con->prepare($sql);
 651:             foreach ($modifiedColumns as $identifier => $columnName) {
 652:                 switch ($columnName) {
 653:                     case '`id`':
 654:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
 655:                         break;
 656:                     case '`code`':
 657:                         $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
 658:                         break;
 659:                     case '`created_at`':
 660:                         $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
 661:                         break;
 662:                     case '`updated_at`':
 663:                         $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
 664:                         break;
 665:                 }
 666:             }
 667:             $stmt->execute();
 668:         } catch (Exception $e) {
 669:             Propel::log($e->getMessage(), Propel::LOG_ERR);
 670:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
 671:         }
 672: 
 673:         try {
 674:             $pk = $con->lastInsertId();
 675:         } catch (Exception $e) {
 676:             throw new PropelException('Unable to get autoincrement id.', $e);
 677:         }
 678:         $this->setId($pk);
 679: 
 680:         $this->setNew(false);
 681:     }
 682: 
 683:     /**
 684:      * Update the row in the database.
 685:      *
 686:      * @param PropelPDO $con
 687:      *
 688:      * @see        doSave()
 689:      */
 690:     protected function doUpdate(PropelPDO $con)
 691:     {
 692:         $selectCriteria = $this->buildPkeyCriteria();
 693:         $valuesCriteria = $this->buildCriteria();
 694:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
 695:     }
 696: 
 697:     /**
 698:      * Array of ValidationFailed objects.
 699:      * @var        array ValidationFailed[]
 700:      */
 701:     protected $validationFailures = array();
 702: 
 703:     /**
 704:      * Gets any ValidationFailed objects that resulted from last call to validate().
 705:      *
 706:      *
 707:      * @return array ValidationFailed[]
 708:      * @see        validate()
 709:      */
 710:     public function getValidationFailures()
 711:     {
 712:         return $this->validationFailures;
 713:     }
 714: 
 715:     /**
 716:      * Validates the objects modified field values and all objects related to this table.
 717:      *
 718:      * If $columns is either a column name or an array of column names
 719:      * only those columns are validated.
 720:      *
 721:      * @param mixed $columns Column name or an array of column names.
 722:      * @return boolean Whether all columns pass validation.
 723:      * @see        doValidate()
 724:      * @see        getValidationFailures()
 725:      */
 726:     public function validate($columns = null)
 727:     {
 728:         $res = $this->doValidate($columns);
 729:         if ($res === true) {
 730:             $this->validationFailures = array();
 731: 
 732:             return true;
 733:         }
 734: 
 735:         $this->validationFailures = $res;
 736: 
 737:         return false;
 738:     }
 739: 
 740:     /**
 741:      * This function performs the validation work for complex object models.
 742:      *
 743:      * In addition to checking the current object, all related objects will
 744:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
 745:      * an aggreagated array of ValidationFailed objects will be returned.
 746:      *
 747:      * @param array $columns Array of column names to validate.
 748:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
 749:      */
 750:     protected function doValidate($columns = null)
 751:     {
 752:         if (!$this->alreadyInValidation) {
 753:             $this->alreadyInValidation = true;
 754:             $retval = null;
 755: 
 756:             $failureMap = array();
 757: 
 758: 
 759:             if (($retval = OrderStatusPeer::doValidate($this, $columns)) !== true) {
 760:                 $failureMap = array_merge($failureMap, $retval);
 761:             }
 762: 
 763: 
 764:                 if ($this->collOrders !== null) {
 765:                     foreach ($this->collOrders as $referrerFK) {
 766:                         if (!$referrerFK->validate($columns)) {
 767:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
 768:                         }
 769:                     }
 770:                 }
 771: 
 772:                 if ($this->collOrderStatusI18ns !== null) {
 773:                     foreach ($this->collOrderStatusI18ns as $referrerFK) {
 774:                         if (!$referrerFK->validate($columns)) {
 775:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
 776:                         }
 777:                     }
 778:                 }
 779: 
 780: 
 781:             $this->alreadyInValidation = false;
 782:         }
 783: 
 784:         return (!empty($failureMap) ? $failureMap : true);
 785:     }
 786: 
 787:     /**
 788:      * Retrieves a field from the object by name passed in as a string.
 789:      *
 790:      * @param string $name name
 791:      * @param string $type The type of fieldname the $name is of:
 792:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 793:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 794:      *               Defaults to BasePeer::TYPE_PHPNAME
 795:      * @return mixed Value of field.
 796:      */
 797:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
 798:     {
 799:         $pos = OrderStatusPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 800:         $field = $this->getByPosition($pos);
 801: 
 802:         return $field;
 803:     }
 804: 
 805:     /**
 806:      * Retrieves a field from the object by Position as specified in the xml schema.
 807:      * Zero-based.
 808:      *
 809:      * @param int $pos position in xml schema
 810:      * @return mixed Value of field at $pos
 811:      */
 812:     public function getByPosition($pos)
 813:     {
 814:         switch ($pos) {
 815:             case 0:
 816:                 return $this->getId();
 817:                 break;
 818:             case 1:
 819:                 return $this->getCode();
 820:                 break;
 821:             case 2:
 822:                 return $this->getCreatedAt();
 823:                 break;
 824:             case 3:
 825:                 return $this->getUpdatedAt();
 826:                 break;
 827:             default:
 828:                 return null;
 829:                 break;
 830:         } // switch()
 831:     }
 832: 
 833:     /**
 834:      * Exports the object as an array.
 835:      *
 836:      * You can specify the key type of the array by passing one of the class
 837:      * type constants.
 838:      *
 839:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
 840:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 841:      *                    Defaults to BasePeer::TYPE_PHPNAME.
 842:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
 843:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
 844:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
 845:      *
 846:      * @return array an associative array containing the field names (as keys) and field values
 847:      */
 848:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 849:     {
 850:         if (isset($alreadyDumpedObjects['OrderStatus'][$this->getPrimaryKey()])) {
 851:             return '*RECURSION*';
 852:         }
 853:         $alreadyDumpedObjects['OrderStatus'][$this->getPrimaryKey()] = true;
 854:         $keys = OrderStatusPeer::getFieldNames($keyType);
 855:         $result = array(
 856:             $keys[0] => $this->getId(),
 857:             $keys[1] => $this->getCode(),
 858:             $keys[2] => $this->getCreatedAt(),
 859:             $keys[3] => $this->getUpdatedAt(),
 860:         );
 861:         if ($includeForeignObjects) {
 862:             if (null !== $this->collOrders) {
 863:                 $result['Orders'] = $this->collOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
 864:             }
 865:             if (null !== $this->collOrderStatusI18ns) {
 866:                 $result['OrderStatusI18ns'] = $this->collOrderStatusI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
 867:             }
 868:         }
 869: 
 870:         return $result;
 871:     }
 872: 
 873:     /**
 874:      * Sets a field from the object by name passed in as a string.
 875:      *
 876:      * @param string $name peer name
 877:      * @param mixed $value field value
 878:      * @param string $type The type of fieldname the $name is of:
 879:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 880:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 881:      *                     Defaults to BasePeer::TYPE_PHPNAME
 882:      * @return void
 883:      */
 884:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
 885:     {
 886:         $pos = OrderStatusPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 887: 
 888:         $this->setByPosition($pos, $value);
 889:     }
 890: 
 891:     /**
 892:      * Sets a field from the object by Position as specified in the xml schema.
 893:      * Zero-based.
 894:      *
 895:      * @param int $pos position in xml schema
 896:      * @param mixed $value field value
 897:      * @return void
 898:      */
 899:     public function setByPosition($pos, $value)
 900:     {
 901:         switch ($pos) {
 902:             case 0:
 903:                 $this->setId($value);
 904:                 break;
 905:             case 1:
 906:                 $this->setCode($value);
 907:                 break;
 908:             case 2:
 909:                 $this->setCreatedAt($value);
 910:                 break;
 911:             case 3:
 912:                 $this->setUpdatedAt($value);
 913:                 break;
 914:         } // switch()
 915:     }
 916: 
 917:     /**
 918:      * Populates the object using an array.
 919:      *
 920:      * This is particularly useful when populating an object from one of the
 921:      * request arrays (e.g. $_POST).  This method goes through the column
 922:      * names, checking to see whether a matching key exists in populated
 923:      * array. If so the setByName() method is called for that column.
 924:      *
 925:      * You can specify the key type of the array by additionally passing one
 926:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
 927:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 928:      * The default key type is the column's BasePeer::TYPE_PHPNAME
 929:      *
 930:      * @param array  $arr     An array to populate the object from.
 931:      * @param string $keyType The type of keys the array uses.
 932:      * @return void
 933:      */
 934:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 935:     {
 936:         $keys = OrderStatusPeer::getFieldNames($keyType);
 937: 
 938:         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
 939:         if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
 940:         if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
 941:         if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
 942:     }
 943: 
 944:     /**
 945:      * Build a Criteria object containing the values of all modified columns in this object.
 946:      *
 947:      * @return Criteria The Criteria object containing all modified values.
 948:      */
 949:     public function buildCriteria()
 950:     {
 951:         $criteria = new Criteria(OrderStatusPeer::DATABASE_NAME);
 952: 
 953:         if ($this->isColumnModified(OrderStatusPeer::ID)) $criteria->add(OrderStatusPeer::ID, $this->id);
 954:         if ($this->isColumnModified(OrderStatusPeer::CODE)) $criteria->add(OrderStatusPeer::CODE, $this->code);
 955:         if ($this->isColumnModified(OrderStatusPeer::CREATED_AT)) $criteria->add(OrderStatusPeer::CREATED_AT, $this->created_at);
 956:         if ($this->isColumnModified(OrderStatusPeer::UPDATED_AT)) $criteria->add(OrderStatusPeer::UPDATED_AT, $this->updated_at);
 957: 
 958:         return $criteria;
 959:     }
 960: 
 961:     /**
 962:      * Builds a Criteria object containing the primary key for this object.
 963:      *
 964:      * Unlike buildCriteria() this method includes the primary key values regardless
 965:      * of whether or not they have been modified.
 966:      *
 967:      * @return Criteria The Criteria object containing value(s) for primary key(s).
 968:      */
 969:     public function buildPkeyCriteria()
 970:     {
 971:         $criteria = new Criteria(OrderStatusPeer::DATABASE_NAME);
 972:         $criteria->add(OrderStatusPeer::ID, $this->id);
 973: 
 974:         return $criteria;
 975:     }
 976: 
 977:     /**
 978:      * Returns the primary key for this object (row).
 979:      * @return int
 980:      */
 981:     public function getPrimaryKey()
 982:     {
 983:         return $this->getId();
 984:     }
 985: 
 986:     /**
 987:      * Generic method to set the primary key (id column).
 988:      *
 989:      * @param  int $key Primary key.
 990:      * @return void
 991:      */
 992:     public function setPrimaryKey($key)
 993:     {
 994:         $this->setId($key);
 995:     }
 996: 
 997:     /**
 998:      * Returns true if the primary key for this object is null.
 999:      * @return boolean
1000:      */
1001:     public function isPrimaryKeyNull()
1002:     {
1003: 
1004:         return null === $this->getId();
1005:     }
1006: 
1007:     /**
1008:      * Sets contents of passed object to values from current object.
1009:      *
1010:      * If desired, this method can also make copies of all associated (fkey referrers)
1011:      * objects.
1012:      *
1013:      * @param object $copyObj An object of OrderStatus (or compatible) type.
1014:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1015:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1016:      * @throws PropelException
1017:      */
1018:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1019:     {
1020:         $copyObj->setCode($this->getCode());
1021:         $copyObj->setCreatedAt($this->getCreatedAt());
1022:         $copyObj->setUpdatedAt($this->getUpdatedAt());
1023: 
1024:         if ($deepCopy && !$this->startCopy) {
1025:             // important: temporarily setNew(false) because this affects the behavior of
1026:             // the getter/setter methods for fkey referrer objects.
1027:             $copyObj->setNew(false);
1028:             // store object hash to prevent cycle
1029:             $this->startCopy = true;
1030: 
1031:             foreach ($this->getOrders() as $relObj) {
1032:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1033:                     $copyObj->addOrder($relObj->copy($deepCopy));
1034:                 }
1035:             }
1036: 
1037:             foreach ($this->getOrderStatusI18ns() as $relObj) {
1038:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1039:                     $copyObj->addOrderStatusI18n($relObj->copy($deepCopy));
1040:                 }
1041:             }
1042: 
1043:             //unflag object copy
1044:             $this->startCopy = false;
1045:         } // if ($deepCopy)
1046: 
1047:         if ($makeNew) {
1048:             $copyObj->setNew(true);
1049:             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1050:         }
1051:     }
1052: 
1053:     /**
1054:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1055:      * It creates a new object filling in the simple attributes, but skipping any primary
1056:      * keys that are defined for the table.
1057:      *
1058:      * If desired, this method can also make copies of all associated (fkey referrers)
1059:      * objects.
1060:      *
1061:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1062:      * @return OrderStatus Clone of current object.
1063:      * @throws PropelException
1064:      */
1065:     public function copy($deepCopy = false)
1066:     {
1067:         // we use get_class(), because this might be a subclass
1068:         $clazz = get_class($this);
1069:         $copyObj = new $clazz();
1070:         $this->copyInto($copyObj, $deepCopy);
1071: 
1072:         return $copyObj;
1073:     }
1074: 
1075:     /**
1076:      * Returns a peer instance associated with this om.
1077:      *
1078:      * Since Peer classes are not to have any instance attributes, this method returns the
1079:      * same instance for all member of this class. The method could therefore
1080:      * be static, but this would prevent one from overriding the behavior.
1081:      *
1082:      * @return OrderStatusPeer
1083:      */
1084:     public function getPeer()
1085:     {
1086:         if (self::$peer === null) {
1087:             self::$peer = new OrderStatusPeer();
1088:         }
1089: 
1090:         return self::$peer;
1091:     }
1092: 
1093: 
1094:     /**
1095:      * Initializes a collection based on the name of a relation.
1096:      * Avoids crafting an 'init[$relationName]s' method name
1097:      * that wouldn't work when StandardEnglishPluralizer is used.
1098:      *
1099:      * @param string $relationName The name of the relation to initialize
1100:      * @return void
1101:      */
1102:     public function initRelation($relationName)
1103:     {
1104:         if ('Order' == $relationName) {
1105:             $this->initOrders();
1106:         }
1107:         if ('OrderStatusI18n' == $relationName) {
1108:             $this->initOrderStatusI18ns();
1109:         }
1110:     }
1111: 
1112:     /**
1113:      * Clears out the collOrders collection
1114:      *
1115:      * This does not modify the database; however, it will remove any associated objects, causing
1116:      * them to be refetched by subsequent calls to accessor method.
1117:      *
1118:      * @return OrderStatus The current object (for fluent API support)
1119:      * @see        addOrders()
1120:      */
1121:     public function clearOrders()
1122:     {
1123:         $this->collOrders = null; // important to set this to null since that means it is uninitialized
1124:         $this->collOrdersPartial = null;
1125: 
1126:         return $this;
1127:     }
1128: 
1129:     /**
1130:      * reset is the collOrders collection loaded partially
1131:      *
1132:      * @return void
1133:      */
1134:     public function resetPartialOrders($v = true)
1135:     {
1136:         $this->collOrdersPartial = $v;
1137:     }
1138: 
1139:     /**
1140:      * Initializes the collOrders collection.
1141:      *
1142:      * By default this just sets the collOrders collection to an empty array (like clearcollOrders());
1143:      * however, you may wish to override this method in your stub class to provide setting appropriate
1144:      * to your application -- for example, setting the initial array to the values stored in database.
1145:      *
1146:      * @param boolean $overrideExisting If set to true, the method call initializes
1147:      *                                        the collection even if it is not empty
1148:      *
1149:      * @return void
1150:      */
1151:     public function initOrders($overrideExisting = true)
1152:     {
1153:         if (null !== $this->collOrders && !$overrideExisting) {
1154:             return;
1155:         }
1156:         $this->collOrders = new PropelObjectCollection();
1157:         $this->collOrders->setModel('Order');
1158:     }
1159: 
1160:     /**
1161:      * Gets an array of Order objects which contain a foreign key that references this object.
1162:      *
1163:      * If the $criteria is not null, it is used to always fetch the results from the database.
1164:      * Otherwise the results are fetched from the database the first time, then cached.
1165:      * Next time the same method is called without $criteria, the cached collection is returned.
1166:      * If this OrderStatus is new, it will return
1167:      * an empty collection or the current collection; the criteria is ignored on a new object.
1168:      *
1169:      * @param Criteria $criteria optional Criteria object to narrow the query
1170:      * @param PropelPDO $con optional connection object
1171:      * @return PropelObjectCollection|Order[] List of Order objects
1172:      * @throws PropelException
1173:      */
1174:     public function getOrders($criteria = null, PropelPDO $con = null)
1175:     {
1176:         $partial = $this->collOrdersPartial && !$this->isNew();
1177:         if (null === $this->collOrders || null !== $criteria  || $partial) {
1178:             if ($this->isNew() && null === $this->collOrders) {
1179:                 // return empty collection
1180:                 $this->initOrders();
1181:             } else {
1182:                 $collOrders = OrderQuery::create(null, $criteria)
1183:                     ->filterByOrderStatus($this)
1184:                     ->find($con);
1185:                 if (null !== $criteria) {
1186:                     if (false !== $this->collOrdersPartial && count($collOrders)) {
1187:                       $this->initOrders(false);
1188: 
1189:                       foreach($collOrders as $obj) {
1190:                         if (false == $this->collOrders->contains($obj)) {
1191:                           $this->collOrders->append($obj);
1192:                         }
1193:                       }
1194: 
1195:                       $this->collOrdersPartial = true;
1196:                     }
1197: 
1198:                     $collOrders->getInternalIterator()->rewind();
1199:                     return $collOrders;
1200:                 }
1201: 
1202:                 if($partial && $this->collOrders) {
1203:                     foreach($this->collOrders as $obj) {
1204:                         if($obj->isNew()) {
1205:                             $collOrders[] = $obj;
1206:                         }
1207:                     }
1208:                 }
1209: 
1210:                 $this->collOrders = $collOrders;
1211:                 $this->collOrdersPartial = false;
1212:             }
1213:         }
1214: 
1215:         return $this->collOrders;
1216:     }
1217: 
1218:     /**
1219:      * Sets a collection of Order objects related by a one-to-many relationship
1220:      * to the current object.
1221:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1222:      * and new objects from the given Propel collection.
1223:      *
1224:      * @param PropelCollection $orders A Propel collection.
1225:      * @param PropelPDO $con Optional connection object
1226:      * @return OrderStatus The current object (for fluent API support)
1227:      */
1228:     public function setOrders(PropelCollection $orders, PropelPDO $con = null)
1229:     {
1230:         $ordersToDelete = $this->getOrders(new Criteria(), $con)->diff($orders);
1231: 
1232:         $this->ordersScheduledForDeletion = unserialize(serialize($ordersToDelete));
1233: 
1234:         foreach ($ordersToDelete as $orderRemoved) {
1235:             $orderRemoved->setOrderStatus(null);
1236:         }
1237: 
1238:         $this->collOrders = null;
1239:         foreach ($orders as $order) {
1240:             $this->addOrder($order);
1241:         }
1242: 
1243:         $this->collOrders = $orders;
1244:         $this->collOrdersPartial = false;
1245: 
1246:         return $this;
1247:     }
1248: 
1249:     /**
1250:      * Returns the number of related Order objects.
1251:      *
1252:      * @param Criteria $criteria
1253:      * @param boolean $distinct
1254:      * @param PropelPDO $con
1255:      * @return int             Count of related Order objects.
1256:      * @throws PropelException
1257:      */
1258:     public function countOrders(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1259:     {
1260:         $partial = $this->collOrdersPartial && !$this->isNew();
1261:         if (null === $this->collOrders || null !== $criteria || $partial) {
1262:             if ($this->isNew() && null === $this->collOrders) {
1263:                 return 0;
1264:             }
1265: 
1266:             if($partial && !$criteria) {
1267:                 return count($this->getOrders());
1268:             }
1269:             $query = OrderQuery::create(null, $criteria);
1270:             if ($distinct) {
1271:                 $query->distinct();
1272:             }
1273: 
1274:             return $query
1275:                 ->filterByOrderStatus($this)
1276:                 ->count($con);
1277:         }
1278: 
1279:         return count($this->collOrders);
1280:     }
1281: 
1282:     /**
1283:      * Method called to associate a Order object to this object
1284:      * through the Order foreign key attribute.
1285:      *
1286:      * @param    Order $l Order
1287:      * @return OrderStatus The current object (for fluent API support)
1288:      */
1289:     public function addOrder(Order $l)
1290:     {
1291:         if ($this->collOrders === null) {
1292:             $this->initOrders();
1293:             $this->collOrdersPartial = true;
1294:         }
1295:         if (!in_array($l, $this->collOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
1296:             $this->doAddOrder($l);
1297:         }
1298: 
1299:         return $this;
1300:     }
1301: 
1302:     /**
1303:      * @param   Order $order The order object to add.
1304:      */
1305:     protected function doAddOrder($order)
1306:     {
1307:         $this->collOrders[]= $order;
1308:         $order->setOrderStatus($this);
1309:     }
1310: 
1311:     /**
1312:      * @param   Order $order The order object to remove.
1313:      * @return OrderStatus The current object (for fluent API support)
1314:      */
1315:     public function removeOrder($order)
1316:     {
1317:         if ($this->getOrders()->contains($order)) {
1318:             $this->collOrders->remove($this->collOrders->search($order));
1319:             if (null === $this->ordersScheduledForDeletion) {
1320:                 $this->ordersScheduledForDeletion = clone $this->collOrders;
1321:                 $this->ordersScheduledForDeletion->clear();
1322:             }
1323:             $this->ordersScheduledForDeletion[]= $order;
1324:             $order->setOrderStatus(null);
1325:         }
1326: 
1327:         return $this;
1328:     }
1329: 
1330: 
1331:     /**
1332:      * If this collection has already been initialized with
1333:      * an identical criteria, it returns the collection.
1334:      * Otherwise if this OrderStatus is new, it will return
1335:      * an empty collection; or if this OrderStatus has previously
1336:      * been saved, it will retrieve related Orders from storage.
1337:      *
1338:      * This method is protected by default in order to keep the public
1339:      * api reasonable.  You can provide public methods for those you
1340:      * actually need in OrderStatus.
1341:      *
1342:      * @param Criteria $criteria optional Criteria object to narrow the query
1343:      * @param PropelPDO $con optional connection object
1344:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1345:      * @return PropelObjectCollection|Order[] List of Order objects
1346:      */
1347:     public function getOrdersJoinCurrency($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1348:     {
1349:         $query = OrderQuery::create(null, $criteria);
1350:         $query->joinWith('Currency', $join_behavior);
1351: 
1352:         return $this->getOrders($query, $con);
1353:     }
1354: 
1355: 
1356:     /**
1357:      * If this collection has already been initialized with
1358:      * an identical criteria, it returns the collection.
1359:      * Otherwise if this OrderStatus is new, it will return
1360:      * an empty collection; or if this OrderStatus has previously
1361:      * been saved, it will retrieve related Orders from storage.
1362:      *
1363:      * This method is protected by default in order to keep the public
1364:      * api reasonable.  You can provide public methods for those you
1365:      * actually need in OrderStatus.
1366:      *
1367:      * @param Criteria $criteria optional Criteria object to narrow the query
1368:      * @param PropelPDO $con optional connection object
1369:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1370:      * @return PropelObjectCollection|Order[] List of Order objects
1371:      */
1372:     public function getOrdersJoinCustomer($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1373:     {
1374:         $query = OrderQuery::create(null, $criteria);
1375:         $query->joinWith('Customer', $join_behavior);
1376: 
1377:         return $this->getOrders($query, $con);
1378:     }
1379: 
1380: 
1381:     /**
1382:      * If this collection has already been initialized with
1383:      * an identical criteria, it returns the collection.
1384:      * Otherwise if this OrderStatus is new, it will return
1385:      * an empty collection; or if this OrderStatus has previously
1386:      * been saved, it will retrieve related Orders from storage.
1387:      *
1388:      * This method is protected by default in order to keep the public
1389:      * api reasonable.  You can provide public methods for those you
1390:      * actually need in OrderStatus.
1391:      *
1392:      * @param Criteria $criteria optional Criteria object to narrow the query
1393:      * @param PropelPDO $con optional connection object
1394:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1395:      * @return PropelObjectCollection|Order[] List of Order objects
1396:      */
1397:     public function getOrdersJoinOrderAddressRelatedByAddressInvoice($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1398:     {
1399:         $query = OrderQuery::create(null, $criteria);
1400:         $query->joinWith('OrderAddressRelatedByAddressInvoice', $join_behavior);
1401: 
1402:         return $this->getOrders($query, $con);
1403:     }
1404: 
1405: 
1406:     /**
1407:      * If this collection has already been initialized with
1408:      * an identical criteria, it returns the collection.
1409:      * Otherwise if this OrderStatus is new, it will return
1410:      * an empty collection; or if this OrderStatus has previously
1411:      * been saved, it will retrieve related Orders from storage.
1412:      *
1413:      * This method is protected by default in order to keep the public
1414:      * api reasonable.  You can provide public methods for those you
1415:      * actually need in OrderStatus.
1416:      *
1417:      * @param Criteria $criteria optional Criteria object to narrow the query
1418:      * @param PropelPDO $con optional connection object
1419:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1420:      * @return PropelObjectCollection|Order[] List of Order objects
1421:      */
1422:     public function getOrdersJoinOrderAddressRelatedByAddressDelivery($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1423:     {
1424:         $query = OrderQuery::create(null, $criteria);
1425:         $query->joinWith('OrderAddressRelatedByAddressDelivery', $join_behavior);
1426: 
1427:         return $this->getOrders($query, $con);
1428:     }
1429: 
1430:     /**
1431:      * Clears out the collOrderStatusI18ns collection
1432:      *
1433:      * This does not modify the database; however, it will remove any associated objects, causing
1434:      * them to be refetched by subsequent calls to accessor method.
1435:      *
1436:      * @return OrderStatus The current object (for fluent API support)
1437:      * @see        addOrderStatusI18ns()
1438:      */
1439:     public function clearOrderStatusI18ns()
1440:     {
1441:         $this->collOrderStatusI18ns = null; // important to set this to null since that means it is uninitialized
1442:         $this->collOrderStatusI18nsPartial = null;
1443: 
1444:         return $this;
1445:     }
1446: 
1447:     /**
1448:      * reset is the collOrderStatusI18ns collection loaded partially
1449:      *
1450:      * @return void
1451:      */
1452:     public function resetPartialOrderStatusI18ns($v = true)
1453:     {
1454:         $this->collOrderStatusI18nsPartial = $v;
1455:     }
1456: 
1457:     /**
1458:      * Initializes the collOrderStatusI18ns collection.
1459:      *
1460:      * By default this just sets the collOrderStatusI18ns collection to an empty array (like clearcollOrderStatusI18ns());
1461:      * however, you may wish to override this method in your stub class to provide setting appropriate
1462:      * to your application -- for example, setting the initial array to the values stored in database.
1463:      *
1464:      * @param boolean $overrideExisting If set to true, the method call initializes
1465:      *                                        the collection even if it is not empty
1466:      *
1467:      * @return void
1468:      */
1469:     public function initOrderStatusI18ns($overrideExisting = true)
1470:     {
1471:         if (null !== $this->collOrderStatusI18ns && !$overrideExisting) {
1472:             return;
1473:         }
1474:         $this->collOrderStatusI18ns = new PropelObjectCollection();
1475:         $this->collOrderStatusI18ns->setModel('OrderStatusI18n');
1476:     }
1477: 
1478:     /**
1479:      * Gets an array of OrderStatusI18n objects which contain a foreign key that references this object.
1480:      *
1481:      * If the $criteria is not null, it is used to always fetch the results from the database.
1482:      * Otherwise the results are fetched from the database the first time, then cached.
1483:      * Next time the same method is called without $criteria, the cached collection is returned.
1484:      * If this OrderStatus is new, it will return
1485:      * an empty collection or the current collection; the criteria is ignored on a new object.
1486:      *
1487:      * @param Criteria $criteria optional Criteria object to narrow the query
1488:      * @param PropelPDO $con optional connection object
1489:      * @return PropelObjectCollection|OrderStatusI18n[] List of OrderStatusI18n objects
1490:      * @throws PropelException
1491:      */
1492:     public function getOrderStatusI18ns($criteria = null, PropelPDO $con = null)
1493:     {
1494:         $partial = $this->collOrderStatusI18nsPartial && !$this->isNew();
1495:         if (null === $this->collOrderStatusI18ns || null !== $criteria  || $partial) {
1496:             if ($this->isNew() && null === $this->collOrderStatusI18ns) {
1497:                 // return empty collection
1498:                 $this->initOrderStatusI18ns();
1499:             } else {
1500:                 $collOrderStatusI18ns = OrderStatusI18nQuery::create(null, $criteria)
1501:                     ->filterByOrderStatus($this)
1502:                     ->find($con);
1503:                 if (null !== $criteria) {
1504:                     if (false !== $this->collOrderStatusI18nsPartial && count($collOrderStatusI18ns)) {
1505:                       $this->initOrderStatusI18ns(false);
1506: 
1507:                       foreach($collOrderStatusI18ns as $obj) {
1508:                         if (false == $this->collOrderStatusI18ns->contains($obj)) {
1509:                           $this->collOrderStatusI18ns->append($obj);
1510:                         }
1511:                       }
1512: 
1513:                       $this->collOrderStatusI18nsPartial = true;
1514:                     }
1515: 
1516:                     $collOrderStatusI18ns->getInternalIterator()->rewind();
1517:                     return $collOrderStatusI18ns;
1518:                 }
1519: 
1520:                 if($partial && $this->collOrderStatusI18ns) {
1521:                     foreach($this->collOrderStatusI18ns as $obj) {
1522:                         if($obj->isNew()) {
1523:                             $collOrderStatusI18ns[] = $obj;
1524:                         }
1525:                     }
1526:                 }
1527: 
1528:                 $this->collOrderStatusI18ns = $collOrderStatusI18ns;
1529:                 $this->collOrderStatusI18nsPartial = false;
1530:             }
1531:         }
1532: 
1533:         return $this->collOrderStatusI18ns;
1534:     }
1535: 
1536:     /**
1537:      * Sets a collection of OrderStatusI18n objects related by a one-to-many relationship
1538:      * to the current object.
1539:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1540:      * and new objects from the given Propel collection.
1541:      *
1542:      * @param PropelCollection $orderStatusI18ns A Propel collection.
1543:      * @param PropelPDO $con Optional connection object
1544:      * @return OrderStatus The current object (for fluent API support)
1545:      */
1546:     public function setOrderStatusI18ns(PropelCollection $orderStatusI18ns, PropelPDO $con = null)
1547:     {
1548:         $orderStatusI18nsToDelete = $this->getOrderStatusI18ns(new Criteria(), $con)->diff($orderStatusI18ns);
1549: 
1550:         $this->orderStatusI18nsScheduledForDeletion = unserialize(serialize($orderStatusI18nsToDelete));
1551: 
1552:         foreach ($orderStatusI18nsToDelete as $orderStatusI18nRemoved) {
1553:             $orderStatusI18nRemoved->setOrderStatus(null);
1554:         }
1555: 
1556:         $this->collOrderStatusI18ns = null;
1557:         foreach ($orderStatusI18ns as $orderStatusI18n) {
1558:             $this->addOrderStatusI18n($orderStatusI18n);
1559:         }
1560: 
1561:         $this->collOrderStatusI18ns = $orderStatusI18ns;
1562:         $this->collOrderStatusI18nsPartial = false;
1563: 
1564:         return $this;
1565:     }
1566: 
1567:     /**
1568:      * Returns the number of related OrderStatusI18n objects.
1569:      *
1570:      * @param Criteria $criteria
1571:      * @param boolean $distinct
1572:      * @param PropelPDO $con
1573:      * @return int             Count of related OrderStatusI18n objects.
1574:      * @throws PropelException
1575:      */
1576:     public function countOrderStatusI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1577:     {
1578:         $partial = $this->collOrderStatusI18nsPartial && !$this->isNew();
1579:         if (null === $this->collOrderStatusI18ns || null !== $criteria || $partial) {
1580:             if ($this->isNew() && null === $this->collOrderStatusI18ns) {
1581:                 return 0;
1582:             }
1583: 
1584:             if($partial && !$criteria) {
1585:                 return count($this->getOrderStatusI18ns());
1586:             }
1587:             $query = OrderStatusI18nQuery::create(null, $criteria);
1588:             if ($distinct) {
1589:                 $query->distinct();
1590:             }
1591: 
1592:             return $query
1593:                 ->filterByOrderStatus($this)
1594:                 ->count($con);
1595:         }
1596: 
1597:         return count($this->collOrderStatusI18ns);
1598:     }
1599: 
1600:     /**
1601:      * Method called to associate a OrderStatusI18n object to this object
1602:      * through the OrderStatusI18n foreign key attribute.
1603:      *
1604:      * @param    OrderStatusI18n $l OrderStatusI18n
1605:      * @return OrderStatus The current object (for fluent API support)
1606:      */
1607:     public function addOrderStatusI18n(OrderStatusI18n $l)
1608:     {
1609:         if ($l && $locale = $l->getLocale()) {
1610:             $this->setLocale($locale);
1611:             $this->currentTranslations[$locale] = $l;
1612:         }
1613:         if ($this->collOrderStatusI18ns === null) {
1614:             $this->initOrderStatusI18ns();
1615:             $this->collOrderStatusI18nsPartial = true;
1616:         }
1617:         if (!in_array($l, $this->collOrderStatusI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
1618:             $this->doAddOrderStatusI18n($l);
1619:         }
1620: 
1621:         return $this;
1622:     }
1623: 
1624:     /**
1625:      * @param   OrderStatusI18n $orderStatusI18n The orderStatusI18n object to add.
1626:      */
1627:     protected function doAddOrderStatusI18n($orderStatusI18n)
1628:     {
1629:         $this->collOrderStatusI18ns[]= $orderStatusI18n;
1630:         $orderStatusI18n->setOrderStatus($this);
1631:     }
1632: 
1633:     /**
1634:      * @param   OrderStatusI18n $orderStatusI18n The orderStatusI18n object to remove.
1635:      * @return OrderStatus The current object (for fluent API support)
1636:      */
1637:     public function removeOrderStatusI18n($orderStatusI18n)
1638:     {
1639:         if ($this->getOrderStatusI18ns()->contains($orderStatusI18n)) {
1640:             $this->collOrderStatusI18ns->remove($this->collOrderStatusI18ns->search($orderStatusI18n));
1641:             if (null === $this->orderStatusI18nsScheduledForDeletion) {
1642:                 $this->orderStatusI18nsScheduledForDeletion = clone $this->collOrderStatusI18ns;
1643:                 $this->orderStatusI18nsScheduledForDeletion->clear();
1644:             }
1645:             $this->orderStatusI18nsScheduledForDeletion[]= clone $orderStatusI18n;
1646:             $orderStatusI18n->setOrderStatus(null);
1647:         }
1648: 
1649:         return $this;
1650:     }
1651: 
1652:     /**
1653:      * Clears the current object and sets all attributes to their default values
1654:      */
1655:     public function clear()
1656:     {
1657:         $this->id = null;
1658:         $this->code = null;
1659:         $this->created_at = null;
1660:         $this->updated_at = null;
1661:         $this->alreadyInSave = false;
1662:         $this->alreadyInValidation = false;
1663:         $this->alreadyInClearAllReferencesDeep = false;
1664:         $this->clearAllReferences();
1665:         $this->resetModified();
1666:         $this->setNew(true);
1667:         $this->setDeleted(false);
1668:     }
1669: 
1670:     /**
1671:      * Resets all references to other model objects or collections of model objects.
1672:      *
1673:      * This method is a user-space workaround for PHP's inability to garbage collect
1674:      * objects with circular references (even in PHP 5.3). This is currently necessary
1675:      * when using Propel in certain daemon or large-volumne/high-memory operations.
1676:      *
1677:      * @param boolean $deep Whether to also clear the references on all referrer objects.
1678:      */
1679:     public function clearAllReferences($deep = false)
1680:     {
1681:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1682:             $this->alreadyInClearAllReferencesDeep = true;
1683:             if ($this->collOrders) {
1684:                 foreach ($this->collOrders as $o) {
1685:                     $o->clearAllReferences($deep);
1686:                 }
1687:             }
1688:             if ($this->collOrderStatusI18ns) {
1689:                 foreach ($this->collOrderStatusI18ns as $o) {
1690:                     $o->clearAllReferences($deep);
1691:                 }
1692:             }
1693: 
1694:             $this->alreadyInClearAllReferencesDeep = false;
1695:         } // if ($deep)
1696: 
1697:         // i18n behavior
1698:         $this->currentLocale = 'en_US';
1699:         $this->currentTranslations = null;
1700: 
1701:         if ($this->collOrders instanceof PropelCollection) {
1702:             $this->collOrders->clearIterator();
1703:         }
1704:         $this->collOrders = null;
1705:         if ($this->collOrderStatusI18ns instanceof PropelCollection) {
1706:             $this->collOrderStatusI18ns->clearIterator();
1707:         }
1708:         $this->collOrderStatusI18ns = null;
1709:     }
1710: 
1711:     /**
1712:      * return the string representation of this object
1713:      *
1714:      * @return string
1715:      */
1716:     public function __toString()
1717:     {
1718:         return (string) $this->exportTo(OrderStatusPeer::DEFAULT_STRING_FORMAT);
1719:     }
1720: 
1721:     /**
1722:      * return true is the object is in saving state
1723:      *
1724:      * @return boolean
1725:      */
1726:     public function isAlreadyInSave()
1727:     {
1728:         return $this->alreadyInSave;
1729:     }
1730: 
1731:     // timestampable behavior
1732: 
1733:     /**
1734:      * Mark the current object so that the update date doesn't get updated during next save
1735:      *
1736:      * @return     OrderStatus The current object (for fluent API support)
1737:      */
1738:     public function keepUpdateDateUnchanged()
1739:     {
1740:         $this->modifiedColumns[] = OrderStatusPeer::UPDATED_AT;
1741: 
1742:         return $this;
1743:     }
1744: 
1745:     // i18n behavior
1746: 
1747:     /**
1748:      * Sets the locale for translations
1749:      *
1750:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
1751:      *
1752:      * @return    OrderStatus The current object (for fluent API support)
1753:      */
1754:     public function setLocale($locale = 'en_US')
1755:     {
1756:         $this->currentLocale = $locale;
1757: 
1758:         return $this;
1759:     }
1760: 
1761:     /**
1762:      * Gets the locale for translations
1763:      *
1764:      * @return    string $locale Locale to use for the translation, e.g. 'fr_FR'
1765:      */
1766:     public function getLocale()
1767:     {
1768:         return $this->currentLocale;
1769:     }
1770: 
1771:     /**
1772:      * Returns the current translation for a given locale
1773:      *
1774:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
1775:      * @param     PropelPDO $con an optional connection object
1776:      *
1777:      * @return OrderStatusI18n */
1778:     public function getTranslation($locale = 'en_US', PropelPDO $con = null)
1779:     {
1780:         if (!isset($this->currentTranslations[$locale])) {
1781:             if (null !== $this->collOrderStatusI18ns) {
1782:                 foreach ($this->collOrderStatusI18ns as $translation) {
1783:                     if ($translation->getLocale() == $locale) {
1784:                         $this->currentTranslations[$locale] = $translation;
1785: 
1786:                         return $translation;
1787:                     }
1788:                 }
1789:             }
1790:             if ($this->isNew()) {
1791:                 $translation = new OrderStatusI18n();
1792:                 $translation->setLocale($locale);
1793:             } else {
1794:                 $translation = OrderStatusI18nQuery::create()
1795:                     ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
1796:                     ->findOneOrCreate($con);
1797:                 $this->currentTranslations[$locale] = $translation;
1798:             }
1799:             $this->addOrderStatusI18n($translation);
1800:         }
1801: 
1802:         return $this->currentTranslations[$locale];
1803:     }
1804: 
1805:     /**
1806:      * Remove the translation for a given locale
1807:      *
1808:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
1809:      * @param     PropelPDO $con an optional connection object
1810:      *
1811:      * @return    OrderStatus The current object (for fluent API support)
1812:      */
1813:     public function removeTranslation($locale = 'en_US', PropelPDO $con = null)
1814:     {
1815:         if (!$this->isNew()) {
1816:             OrderStatusI18nQuery::create()
1817:                 ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
1818:                 ->delete($con);
1819:         }
1820:         if (isset($this->currentTranslations[$locale])) {
1821:             unset($this->currentTranslations[$locale]);
1822:         }
1823:         foreach ($this->collOrderStatusI18ns as $key => $translation) {
1824:             if ($translation->getLocale() == $locale) {
1825:                 unset($this->collOrderStatusI18ns[$key]);
1826:                 break;
1827:             }
1828:         }
1829: 
1830:         return $this;
1831:     }
1832: 
1833:     /**
1834:      * Returns the current translation
1835:      *
1836:      * @param     PropelPDO $con an optional connection object
1837:      *
1838:      * @return OrderStatusI18n */
1839:     public function getCurrentTranslation(PropelPDO $con = null)
1840:     {
1841:         return $this->getTranslation($this->getLocale(), $con);
1842:     }
1843: 
1844: 
1845:         /**
1846:          * Get the [title] column value.
1847:          *
1848:          * @return string
1849:          */
1850:         public function getTitle()
1851:         {
1852:         return $this->getCurrentTranslation()->getTitle();
1853:     }
1854: 
1855: 
1856:         /**
1857:          * Set the value of [title] column.
1858:          *
1859:          * @param string $v new value
1860:          * @return OrderStatusI18n The current object (for fluent API support)
1861:          */
1862:         public function setTitle($v)
1863:         {    $this->getCurrentTranslation()->setTitle($v);
1864: 
1865:         return $this;
1866:     }
1867: 
1868: 
1869:         /**
1870:          * Get the [description] column value.
1871:          *
1872:          * @return string
1873:          */
1874:         public function getDescription()
1875:         {
1876:         return $this->getCurrentTranslation()->getDescription();
1877:     }
1878: 
1879: 
1880:         /**
1881:          * Set the value of [description] column.
1882:          *
1883:          * @param string $v new value
1884:          * @return OrderStatusI18n The current object (for fluent API support)
1885:          */
1886:         public function setDescription($v)
1887:         {    $this->getCurrentTranslation()->setDescription($v);
1888: 
1889:         return $this;
1890:     }
1891: 
1892: 
1893:         /**
1894:          * Get the [chapo] column value.
1895:          *
1896:          * @return string
1897:          */
1898:         public function getChapo()
1899:         {
1900:         return $this->getCurrentTranslation()->getChapo();
1901:     }
1902: 
1903: 
1904:         /**
1905:          * Set the value of [chapo] column.
1906:          *
1907:          * @param string $v new value
1908:          * @return OrderStatusI18n The current object (for fluent API support)
1909:          */
1910:         public function setChapo($v)
1911:         {    $this->getCurrentTranslation()->setChapo($v);
1912: 
1913:         return $this;
1914:     }
1915: 
1916: 
1917:         /**
1918:          * Get the [postscriptum] column value.
1919:          *
1920:          * @return string
1921:          */
1922:         public function getPostscriptum()
1923:         {
1924:         return $this->getCurrentTranslation()->getPostscriptum();
1925:     }
1926: 
1927: 
1928:         /**
1929:          * Set the value of [postscriptum] column.
1930:          *
1931:          * @param string $v new value
1932:          * @return OrderStatusI18n The current object (for fluent API support)
1933:          */
1934:         public function setPostscriptum($v)
1935:         {    $this->getCurrentTranslation()->setPostscriptum($v);
1936: 
1937:         return $this;
1938:     }
1939: 
1940: }
1941: 
thelia API documentation generated by ApiGen 2.8.0