Overview

Namespaces

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

Classes

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