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 \PropelDateTime;
  14: use \PropelException;
  15: use \PropelPDO;
  16: use Thelia\Model\Area;
  17: use Thelia\Model\AreaQuery;
  18: use Thelia\Model\Delivzone;
  19: use Thelia\Model\DelivzonePeer;
  20: use Thelia\Model\DelivzoneQuery;
  21: 
  22: /**
  23:  * Base class that represents a row from the 'delivzone' table.
  24:  *
  25:  *
  26:  *
  27:  * @package    propel.generator.Thelia.Model.om
  28:  */
  29: abstract class BaseDelivzone extends BaseObject implements Persistent
  30: {
  31:     /**
  32:      * Peer class name
  33:      */
  34:     const PEER = 'Thelia\\Model\\DelivzonePeer';
  35: 
  36:     /**
  37:      * The Peer class.
  38:      * Instance provides a convenient way of calling static methods on a class
  39:      * that calling code may not be able to identify.
  40:      * @var        DelivzonePeer
  41:      */
  42:     protected static $peer;
  43: 
  44:     /**
  45:      * The flag var to prevent infinit loop in deep copy
  46:      * @var       boolean
  47:      */
  48:     protected $startCopy = false;
  49: 
  50:     /**
  51:      * The value for the id field.
  52:      * @var        int
  53:      */
  54:     protected $id;
  55: 
  56:     /**
  57:      * The value for the area_id field.
  58:      * @var        int
  59:      */
  60:     protected $area_id;
  61: 
  62:     /**
  63:      * The value for the delivery field.
  64:      * @var        string
  65:      */
  66:     protected $delivery;
  67: 
  68:     /**
  69:      * The value for the created_at field.
  70:      * @var        string
  71:      */
  72:     protected $created_at;
  73: 
  74:     /**
  75:      * The value for the updated_at field.
  76:      * @var        string
  77:      */
  78:     protected $updated_at;
  79: 
  80:     /**
  81:      * @var        Area
  82:      */
  83:     protected $aArea;
  84: 
  85:     /**
  86:      * Flag to prevent endless save loop, if this object is referenced
  87:      * by another object which falls in this transaction.
  88:      * @var        boolean
  89:      */
  90:     protected $alreadyInSave = false;
  91: 
  92:     /**
  93:      * Flag to prevent endless validation loop, if this object is referenced
  94:      * by another object which falls in this transaction.
  95:      * @var        boolean
  96:      */
  97:     protected $alreadyInValidation = false;
  98: 
  99:     /**
 100:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
 101:      * @var        boolean
 102:      */
 103:     protected $alreadyInClearAllReferencesDeep = false;
 104: 
 105:     /**
 106:      * Get the [id] column value.
 107:      *
 108:      * @return int
 109:      */
 110:     public function getId()
 111:     {
 112:         return $this->id;
 113:     }
 114: 
 115:     /**
 116:      * Get the [area_id] column value.
 117:      *
 118:      * @return int
 119:      */
 120:     public function getAreaId()
 121:     {
 122:         return $this->area_id;
 123:     }
 124: 
 125:     /**
 126:      * Get the [delivery] column value.
 127:      *
 128:      * @return string
 129:      */
 130:     public function getDelivery()
 131:     {
 132:         return $this->delivery;
 133:     }
 134: 
 135:     /**
 136:      * Get the [optionally formatted] temporal [created_at] column value.
 137:      *
 138:      *
 139:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 140:      *               If format is null, then the raw DateTime object will be returned.
 141:      * @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
 142:      * @throws PropelException - if unable to parse/validate the date/time value.
 143:      */
 144:     public function getCreatedAt($format = 'Y-m-d H:i:s')
 145:     {
 146:         if ($this->created_at === null) {
 147:             return null;
 148:         }
 149: 
 150:         if ($this->created_at === '0000-00-00 00:00:00') {
 151:             // while technically this is not a default value of null,
 152:             // this seems to be closest in meaning.
 153:             return null;
 154:         }
 155: 
 156:         try {
 157:             $dt = new DateTime($this->created_at);
 158:         } catch (Exception $x) {
 159:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
 160:         }
 161: 
 162:         if ($format === null) {
 163:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 164:             return $dt;
 165:         }
 166: 
 167:         if (strpos($format, '%') !== false) {
 168:             return strftime($format, $dt->format('U'));
 169:         }
 170: 
 171:         return $dt->format($format);
 172: 
 173:     }
 174: 
 175:     /**
 176:      * Get the [optionally formatted] temporal [updated_at] column value.
 177:      *
 178:      *
 179:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 180:      *               If format is null, then the raw DateTime object will be returned.
 181:      * @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
 182:      * @throws PropelException - if unable to parse/validate the date/time value.
 183:      */
 184:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
 185:     {
 186:         if ($this->updated_at === null) {
 187:             return null;
 188:         }
 189: 
 190:         if ($this->updated_at === '0000-00-00 00:00:00') {
 191:             // while technically this is not a default value of null,
 192:             // this seems to be closest in meaning.
 193:             return null;
 194:         }
 195: 
 196:         try {
 197:             $dt = new DateTime($this->updated_at);
 198:         } catch (Exception $x) {
 199:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
 200:         }
 201: 
 202:         if ($format === null) {
 203:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 204:             return $dt;
 205:         }
 206: 
 207:         if (strpos($format, '%') !== false) {
 208:             return strftime($format, $dt->format('U'));
 209:         }
 210: 
 211:         return $dt->format($format);
 212: 
 213:     }
 214: 
 215:     /**
 216:      * Set the value of [id] column.
 217:      *
 218:      * @param int $v new value
 219:      * @return Delivzone The current object (for fluent API support)
 220:      */
 221:     public function setId($v)
 222:     {
 223:         if ($v !== null && is_numeric($v)) {
 224:             $v = (int) $v;
 225:         }
 226: 
 227:         if ($this->id !== $v) {
 228:             $this->id = $v;
 229:             $this->modifiedColumns[] = DelivzonePeer::ID;
 230:         }
 231: 
 232: 
 233:         return $this;
 234:     } // setId()
 235: 
 236:     /**
 237:      * Set the value of [area_id] column.
 238:      *
 239:      * @param int $v new value
 240:      * @return Delivzone The current object (for fluent API support)
 241:      */
 242:     public function setAreaId($v)
 243:     {
 244:         if ($v !== null && is_numeric($v)) {
 245:             $v = (int) $v;
 246:         }
 247: 
 248:         if ($this->area_id !== $v) {
 249:             $this->area_id = $v;
 250:             $this->modifiedColumns[] = DelivzonePeer::AREA_ID;
 251:         }
 252: 
 253:         if ($this->aArea !== null && $this->aArea->getId() !== $v) {
 254:             $this->aArea = null;
 255:         }
 256: 
 257: 
 258:         return $this;
 259:     } // setAreaId()
 260: 
 261:     /**
 262:      * Set the value of [delivery] column.
 263:      *
 264:      * @param string $v new value
 265:      * @return Delivzone The current object (for fluent API support)
 266:      */
 267:     public function setDelivery($v)
 268:     {
 269:         if ($v !== null && is_numeric($v)) {
 270:             $v = (string) $v;
 271:         }
 272: 
 273:         if ($this->delivery !== $v) {
 274:             $this->delivery = $v;
 275:             $this->modifiedColumns[] = DelivzonePeer::DELIVERY;
 276:         }
 277: 
 278: 
 279:         return $this;
 280:     } // setDelivery()
 281: 
 282:     /**
 283:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
 284:      *
 285:      * @param mixed $v string, integer (timestamp), or DateTime value.
 286:      *               Empty strings are treated as null.
 287:      * @return Delivzone The current object (for fluent API support)
 288:      */
 289:     public function setCreatedAt($v)
 290:     {
 291:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 292:         if ($this->created_at !== null || $dt !== null) {
 293:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 294:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 295:             if ($currentDateAsString !== $newDateAsString) {
 296:                 $this->created_at = $newDateAsString;
 297:                 $this->modifiedColumns[] = DelivzonePeer::CREATED_AT;
 298:             }
 299:         } // if either are not null
 300: 
 301: 
 302:         return $this;
 303:     } // setCreatedAt()
 304: 
 305:     /**
 306:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
 307:      *
 308:      * @param mixed $v string, integer (timestamp), or DateTime value.
 309:      *               Empty strings are treated as null.
 310:      * @return Delivzone The current object (for fluent API support)
 311:      */
 312:     public function setUpdatedAt($v)
 313:     {
 314:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 315:         if ($this->updated_at !== null || $dt !== null) {
 316:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 317:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 318:             if ($currentDateAsString !== $newDateAsString) {
 319:                 $this->updated_at = $newDateAsString;
 320:                 $this->modifiedColumns[] = DelivzonePeer::UPDATED_AT;
 321:             }
 322:         } // if either are not null
 323: 
 324: 
 325:         return $this;
 326:     } // setUpdatedAt()
 327: 
 328:     /**
 329:      * Indicates whether the columns in this object are only set to default values.
 330:      *
 331:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 332:      * modified _and_ has some values set which are non-default.
 333:      *
 334:      * @return boolean Whether the columns in this object are only been set with default values.
 335:      */
 336:     public function hasOnlyDefaultValues()
 337:     {
 338:         // otherwise, everything was equal, so return true
 339:         return true;
 340:     } // hasOnlyDefaultValues()
 341: 
 342:     /**
 343:      * Hydrates (populates) the object variables with values from the database resultset.
 344:      *
 345:      * An offset (0-based "start column") is specified so that objects can be hydrated
 346:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 347:      * for results of JOIN queries where the resultset row includes columns from two or
 348:      * more tables.
 349:      *
 350:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 351:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 352:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 353:      * @return int             next starting column
 354:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 355:      */
 356:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 357:     {
 358:         try {
 359: 
 360:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 361:             $this->area_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
 362:             $this->delivery = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
 363:             $this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 364:             $this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 365:             $this->resetModified();
 366: 
 367:             $this->setNew(false);
 368: 
 369:             if ($rehydrate) {
 370:                 $this->ensureConsistency();
 371:             }
 372:             $this->postHydrate($row, $startcol, $rehydrate);
 373:             return $startcol + 5; // 5 = DelivzonePeer::NUM_HYDRATE_COLUMNS.
 374: 
 375:         } catch (Exception $e) {
 376:             throw new PropelException("Error populating Delivzone object", $e);
 377:         }
 378:     }
 379: 
 380:     /**
 381:      * Checks and repairs the internal consistency of the object.
 382:      *
 383:      * This method is executed after an already-instantiated object is re-hydrated
 384:      * from the database.  It exists to check any foreign keys to make sure that
 385:      * the objects related to the current object are correct based on foreign key.
 386:      *
 387:      * You can override this method in the stub class, but you should always invoke
 388:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 389:      * in case your model changes.
 390:      *
 391:      * @throws PropelException
 392:      */
 393:     public function ensureConsistency()
 394:     {
 395: 
 396:         if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
 397:             $this->aArea = null;
 398:         }
 399:     } // ensureConsistency
 400: 
 401:     /**
 402:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 403:      *
 404:      * This will only work if the object has been saved and has a valid primary key set.
 405:      *
 406:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 407:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 408:      * @return void
 409:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 410:      */
 411:     public function reload($deep = false, PropelPDO $con = null)
 412:     {
 413:         if ($this->isDeleted()) {
 414:             throw new PropelException("Cannot reload a deleted object.");
 415:         }
 416: 
 417:         if ($this->isNew()) {
 418:             throw new PropelException("Cannot reload an unsaved object.");
 419:         }
 420: 
 421:         if ($con === null) {
 422:             $con = Propel::getConnection(DelivzonePeer::DATABASE_NAME, Propel::CONNECTION_READ);
 423:         }
 424: 
 425:         // We don't need to alter the object instance pool; we're just modifying this instance
 426:         // already in the pool.
 427: 
 428:         $stmt = DelivzonePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 429:         $row = $stmt->fetch(PDO::FETCH_NUM);
 430:         $stmt->closeCursor();
 431:         if (!$row) {
 432:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 433:         }
 434:         $this->hydrate($row, 0, true); // rehydrate
 435: 
 436:         if ($deep) {  // also de-associate any related objects?
 437: 
 438:             $this->aArea = null;
 439:         } // if (deep)
 440:     }
 441: 
 442:     /**
 443:      * Removes this object from datastore and sets delete attribute.
 444:      *
 445:      * @param PropelPDO $con
 446:      * @return void
 447:      * @throws PropelException
 448:      * @throws Exception
 449:      * @see        BaseObject::setDeleted()
 450:      * @see        BaseObject::isDeleted()
 451:      */
 452:     public function delete(PropelPDO $con = null)
 453:     {
 454:         if ($this->isDeleted()) {
 455:             throw new PropelException("This object has already been deleted.");
 456:         }
 457: 
 458:         if ($con === null) {
 459:             $con = Propel::getConnection(DelivzonePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 460:         }
 461: 
 462:         $con->beginTransaction();
 463:         try {
 464:             $deleteQuery = DelivzoneQuery::create()
 465:                 ->filterByPrimaryKey($this->getPrimaryKey());
 466:             $ret = $this->preDelete($con);
 467:             if ($ret) {
 468:                 $deleteQuery->delete($con);
 469:                 $this->postDelete($con);
 470:                 $con->commit();
 471:                 $this->setDeleted(true);
 472:             } else {
 473:                 $con->commit();
 474:             }
 475:         } catch (Exception $e) {
 476:             $con->rollBack();
 477:             throw $e;
 478:         }
 479:     }
 480: 
 481:     /**
 482:      * Persists this object to the database.
 483:      *
 484:      * If the object is new, it inserts it; otherwise an update is performed.
 485:      * All modified related objects will also be persisted in the doSave()
 486:      * method.  This method wraps all precipitate database operations in a
 487:      * single transaction.
 488:      *
 489:      * @param PropelPDO $con
 490:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 491:      * @throws PropelException
 492:      * @throws Exception
 493:      * @see        doSave()
 494:      */
 495:     public function save(PropelPDO $con = null)
 496:     {
 497:         if ($this->isDeleted()) {
 498:             throw new PropelException("You cannot save an object that has been deleted.");
 499:         }
 500: 
 501:         if ($con === null) {
 502:             $con = Propel::getConnection(DelivzonePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 503:         }
 504: 
 505:         $con->beginTransaction();
 506:         $isInsert = $this->isNew();
 507:         try {
 508:             $ret = $this->preSave($con);
 509:             if ($isInsert) {
 510:                 $ret = $ret && $this->preInsert($con);
 511:                 // timestampable behavior
 512:                 if (!$this->isColumnModified(DelivzonePeer::CREATED_AT)) {
 513:                     $this->setCreatedAt(time());
 514:                 }
 515:                 if (!$this->isColumnModified(DelivzonePeer::UPDATED_AT)) {
 516:                     $this->setUpdatedAt(time());
 517:                 }
 518:             } else {
 519:                 $ret = $ret && $this->preUpdate($con);
 520:                 // timestampable behavior
 521:                 if ($this->isModified() && !$this->isColumnModified(DelivzonePeer::UPDATED_AT)) {
 522:                     $this->setUpdatedAt(time());
 523:                 }
 524:             }
 525:             if ($ret) {
 526:                 $affectedRows = $this->doSave($con);
 527:                 if ($isInsert) {
 528:                     $this->postInsert($con);
 529:                 } else {
 530:                     $this->postUpdate($con);
 531:                 }
 532:                 $this->postSave($con);
 533:                 DelivzonePeer::addInstanceToPool($this);
 534:             } else {
 535:                 $affectedRows = 0;
 536:             }
 537:             $con->commit();
 538: 
 539:             return $affectedRows;
 540:         } catch (Exception $e) {
 541:             $con->rollBack();
 542:             throw $e;
 543:         }
 544:     }
 545: 
 546:     /**
 547:      * Performs the work of inserting or updating the row in the database.
 548:      *
 549:      * If the object is new, it inserts it; otherwise an update is performed.
 550:      * All related objects are also updated in this method.
 551:      *
 552:      * @param PropelPDO $con
 553:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 554:      * @throws PropelException
 555:      * @see        save()
 556:      */
 557:     protected function doSave(PropelPDO $con)
 558:     {
 559:         $affectedRows = 0; // initialize var to track total num of affected rows
 560:         if (!$this->alreadyInSave) {
 561:             $this->alreadyInSave = true;
 562: 
 563:             // We call the save method on the following object(s) if they
 564:             // were passed to this object by their coresponding set
 565:             // method.  This object relates to these object(s) by a
 566:             // foreign key reference.
 567: 
 568:             if ($this->aArea !== null) {
 569:                 if ($this->aArea->isModified() || $this->aArea->isNew()) {
 570:                     $affectedRows += $this->aArea->save($con);
 571:                 }
 572:                 $this->setArea($this->aArea);
 573:             }
 574: 
 575:             if ($this->isNew() || $this->isModified()) {
 576:                 // persist changes
 577:                 if ($this->isNew()) {
 578:                     $this->doInsert($con);
 579:                 } else {
 580:                     $this->doUpdate($con);
 581:                 }
 582:                 $affectedRows += 1;
 583:                 $this->resetModified();
 584:             }
 585: 
 586:             $this->alreadyInSave = false;
 587: 
 588:         }
 589: 
 590:         return $affectedRows;
 591:     } // doSave()
 592: 
 593:     /**
 594:      * Insert the row in the database.
 595:      *
 596:      * @param PropelPDO $con
 597:      *
 598:      * @throws PropelException
 599:      * @see        doSave()
 600:      */
 601:     protected function doInsert(PropelPDO $con)
 602:     {
 603:         $modifiedColumns = array();
 604:         $index = 0;
 605: 
 606:         $this->modifiedColumns[] = DelivzonePeer::ID;
 607:         if (null !== $this->id) {
 608:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . DelivzonePeer::ID . ')');
 609:         }
 610: 
 611:          // check the columns in natural order for more readable SQL queries
 612:         if ($this->isColumnModified(DelivzonePeer::ID)) {
 613:             $modifiedColumns[':p' . $index++]  = '`id`';
 614:         }
 615:         if ($this->isColumnModified(DelivzonePeer::AREA_ID)) {
 616:             $modifiedColumns[':p' . $index++]  = '`area_id`';
 617:         }
 618:         if ($this->isColumnModified(DelivzonePeer::DELIVERY)) {
 619:             $modifiedColumns[':p' . $index++]  = '`delivery`';
 620:         }
 621:         if ($this->isColumnModified(DelivzonePeer::CREATED_AT)) {
 622:             $modifiedColumns[':p' . $index++]  = '`created_at`';
 623:         }
 624:         if ($this->isColumnModified(DelivzonePeer::UPDATED_AT)) {
 625:             $modifiedColumns[':p' . $index++]  = '`updated_at`';
 626:         }
 627: 
 628:         $sql = sprintf(
 629:             'INSERT INTO `delivzone` (%s) VALUES (%s)',
 630:             implode(', ', $modifiedColumns),
 631:             implode(', ', array_keys($modifiedColumns))
 632:         );
 633: 
 634:         try {
 635:             $stmt = $con->prepare($sql);
 636:             foreach ($modifiedColumns as $identifier => $columnName) {
 637:                 switch ($columnName) {
 638:                     case '`id`':
 639:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
 640:                         break;
 641:                     case '`area_id`':
 642:                         $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
 643:                         break;
 644:                     case '`delivery`':
 645:                         $stmt->bindValue($identifier, $this->delivery, 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:         }
 722: 
 723:         $this->validationFailures = $res;
 724: 
 725:         return false;
 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:             // We call the validate method on the following object(s) if they
 748:             // were passed to this object by their coresponding set
 749:             // method.  This object relates to these object(s) by a
 750:             // foreign key reference.
 751: 
 752:             if ($this->aArea !== null) {
 753:                 if (!$this->aArea->validate($columns)) {
 754:                     $failureMap = array_merge($failureMap, $this->aArea->getValidationFailures());
 755:                 }
 756:             }
 757: 
 758: 
 759:             if (($retval = DelivzonePeer::doValidate($this, $columns)) !== true) {
 760:                 $failureMap = array_merge($failureMap, $retval);
 761:             }
 762: 
 763: 
 764: 
 765:             $this->alreadyInValidation = false;
 766:         }
 767: 
 768:         return (!empty($failureMap) ? $failureMap : true);
 769:     }
 770: 
 771:     /**
 772:      * Retrieves a field from the object by name passed in as a string.
 773:      *
 774:      * @param string $name name
 775:      * @param string $type The type of fieldname the $name is of:
 776:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 777:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 778:      *               Defaults to BasePeer::TYPE_PHPNAME
 779:      * @return mixed Value of field.
 780:      */
 781:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
 782:     {
 783:         $pos = DelivzonePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 784:         $field = $this->getByPosition($pos);
 785: 
 786:         return $field;
 787:     }
 788: 
 789:     /**
 790:      * Retrieves a field from the object by Position as specified in the xml schema.
 791:      * Zero-based.
 792:      *
 793:      * @param int $pos position in xml schema
 794:      * @return mixed Value of field at $pos
 795:      */
 796:     public function getByPosition($pos)
 797:     {
 798:         switch ($pos) {
 799:             case 0:
 800:                 return $this->getId();
 801:                 break;
 802:             case 1:
 803:                 return $this->getAreaId();
 804:                 break;
 805:             case 2:
 806:                 return $this->getDelivery();
 807:                 break;
 808:             case 3:
 809:                 return $this->getCreatedAt();
 810:                 break;
 811:             case 4:
 812:                 return $this->getUpdatedAt();
 813:                 break;
 814:             default:
 815:                 return null;
 816:                 break;
 817:         } // switch()
 818:     }
 819: 
 820:     /**
 821:      * Exports the object as an array.
 822:      *
 823:      * You can specify the key type of the array by passing one of the class
 824:      * type constants.
 825:      *
 826:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
 827:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 828:      *                    Defaults to BasePeer::TYPE_PHPNAME.
 829:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
 830:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
 831:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
 832:      *
 833:      * @return array an associative array containing the field names (as keys) and field values
 834:      */
 835:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 836:     {
 837:         if (isset($alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()])) {
 838:             return '*RECURSION*';
 839:         }
 840:         $alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()] = true;
 841:         $keys = DelivzonePeer::getFieldNames($keyType);
 842:         $result = array(
 843:             $keys[0] => $this->getId(),
 844:             $keys[1] => $this->getAreaId(),
 845:             $keys[2] => $this->getDelivery(),
 846:             $keys[3] => $this->getCreatedAt(),
 847:             $keys[4] => $this->getUpdatedAt(),
 848:         );
 849:         if ($includeForeignObjects) {
 850:             if (null !== $this->aArea) {
 851:                 $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
 852:             }
 853:         }
 854: 
 855:         return $result;
 856:     }
 857: 
 858:     /**
 859:      * Sets a field from the object by name passed in as a string.
 860:      *
 861:      * @param string $name peer name
 862:      * @param mixed $value field value
 863:      * @param string $type The type of fieldname the $name is of:
 864:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 865:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 866:      *                     Defaults to BasePeer::TYPE_PHPNAME
 867:      * @return void
 868:      */
 869:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
 870:     {
 871:         $pos = DelivzonePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 872: 
 873:         $this->setByPosition($pos, $value);
 874:     }
 875: 
 876:     /**
 877:      * Sets a field from the object by Position as specified in the xml schema.
 878:      * Zero-based.
 879:      *
 880:      * @param int $pos position in xml schema
 881:      * @param mixed $value field value
 882:      * @return void
 883:      */
 884:     public function setByPosition($pos, $value)
 885:     {
 886:         switch ($pos) {
 887:             case 0:
 888:                 $this->setId($value);
 889:                 break;
 890:             case 1:
 891:                 $this->setAreaId($value);
 892:                 break;
 893:             case 2:
 894:                 $this->setDelivery($value);
 895:                 break;
 896:             case 3:
 897:                 $this->setCreatedAt($value);
 898:                 break;
 899:             case 4:
 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 = DelivzonePeer::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->setAreaId($arr[$keys[1]]);
 928:         if (array_key_exists($keys[2], $arr)) $this->setDelivery($arr[$keys[2]]);
 929:         if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
 930:         if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
 931:     }
 932: 
 933:     /**
 934:      * Build a Criteria object containing the values of all modified columns in this object.
 935:      *
 936:      * @return Criteria The Criteria object containing all modified values.
 937:      */
 938:     public function buildCriteria()
 939:     {
 940:         $criteria = new Criteria(DelivzonePeer::DATABASE_NAME);
 941: 
 942:         if ($this->isColumnModified(DelivzonePeer::ID)) $criteria->add(DelivzonePeer::ID, $this->id);
 943:         if ($this->isColumnModified(DelivzonePeer::AREA_ID)) $criteria->add(DelivzonePeer::AREA_ID, $this->area_id);
 944:         if ($this->isColumnModified(DelivzonePeer::DELIVERY)) $criteria->add(DelivzonePeer::DELIVERY, $this->delivery);
 945:         if ($this->isColumnModified(DelivzonePeer::CREATED_AT)) $criteria->add(DelivzonePeer::CREATED_AT, $this->created_at);
 946:         if ($this->isColumnModified(DelivzonePeer::UPDATED_AT)) $criteria->add(DelivzonePeer::UPDATED_AT, $this->updated_at);
 947: 
 948:         return $criteria;
 949:     }
 950: 
 951:     /**
 952:      * Builds a Criteria object containing the primary key for this object.
 953:      *
 954:      * Unlike buildCriteria() this method includes the primary key values regardless
 955:      * of whether or not they have been modified.
 956:      *
 957:      * @return Criteria The Criteria object containing value(s) for primary key(s).
 958:      */
 959:     public function buildPkeyCriteria()
 960:     {
 961:         $criteria = new Criteria(DelivzonePeer::DATABASE_NAME);
 962:         $criteria->add(DelivzonePeer::ID, $this->id);
 963: 
 964:         return $criteria;
 965:     }
 966: 
 967:     /**
 968:      * Returns the primary key for this object (row).
 969:      * @return int
 970:      */
 971:     public function getPrimaryKey()
 972:     {
 973:         return $this->getId();
 974:     }
 975: 
 976:     /**
 977:      * Generic method to set the primary key (id column).
 978:      *
 979:      * @param  int $key Primary key.
 980:      * @return void
 981:      */
 982:     public function setPrimaryKey($key)
 983:     {
 984:         $this->setId($key);
 985:     }
 986: 
 987:     /**
 988:      * Returns true if the primary key for this object is null.
 989:      * @return boolean
 990:      */
 991:     public function isPrimaryKeyNull()
 992:     {
 993: 
 994:         return null === $this->getId();
 995:     }
 996: 
 997:     /**
 998:      * Sets contents of passed object to values from current object.
 999:      *
1000:      * If desired, this method can also make copies of all associated (fkey referrers)
1001:      * objects.
1002:      *
1003:      * @param object $copyObj An object of Delivzone (or compatible) type.
1004:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1005:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1006:      * @throws PropelException
1007:      */
1008:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1009:     {
1010:         $copyObj->setAreaId($this->getAreaId());
1011:         $copyObj->setDelivery($this->getDelivery());
1012:         $copyObj->setCreatedAt($this->getCreatedAt());
1013:         $copyObj->setUpdatedAt($this->getUpdatedAt());
1014: 
1015:         if ($deepCopy && !$this->startCopy) {
1016:             // important: temporarily setNew(false) because this affects the behavior of
1017:             // the getter/setter methods for fkey referrer objects.
1018:             $copyObj->setNew(false);
1019:             // store object hash to prevent cycle
1020:             $this->startCopy = true;
1021: 
1022:             //unflag object copy
1023:             $this->startCopy = false;
1024:         } // if ($deepCopy)
1025: 
1026:         if ($makeNew) {
1027:             $copyObj->setNew(true);
1028:             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1029:         }
1030:     }
1031: 
1032:     /**
1033:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1034:      * It creates a new object filling in the simple attributes, but skipping any primary
1035:      * keys that are defined for the table.
1036:      *
1037:      * If desired, this method can also make copies of all associated (fkey referrers)
1038:      * objects.
1039:      *
1040:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1041:      * @return Delivzone Clone of current object.
1042:      * @throws PropelException
1043:      */
1044:     public function copy($deepCopy = false)
1045:     {
1046:         // we use get_class(), because this might be a subclass
1047:         $clazz = get_class($this);
1048:         $copyObj = new $clazz();
1049:         $this->copyInto($copyObj, $deepCopy);
1050: 
1051:         return $copyObj;
1052:     }
1053: 
1054:     /**
1055:      * Returns a peer instance associated with this om.
1056:      *
1057:      * Since Peer classes are not to have any instance attributes, this method returns the
1058:      * same instance for all member of this class. The method could therefore
1059:      * be static, but this would prevent one from overriding the behavior.
1060:      *
1061:      * @return DelivzonePeer
1062:      */
1063:     public function getPeer()
1064:     {
1065:         if (self::$peer === null) {
1066:             self::$peer = new DelivzonePeer();
1067:         }
1068: 
1069:         return self::$peer;
1070:     }
1071: 
1072:     /**
1073:      * Declares an association between this object and a Area object.
1074:      *
1075:      * @param             Area $v
1076:      * @return Delivzone The current object (for fluent API support)
1077:      * @throws PropelException
1078:      */
1079:     public function setArea(Area $v = null)
1080:     {
1081:         if ($v === null) {
1082:             $this->setAreaId(NULL);
1083:         } else {
1084:             $this->setAreaId($v->getId());
1085:         }
1086: 
1087:         $this->aArea = $v;
1088: 
1089:         // Add binding for other direction of this n:n relationship.
1090:         // If this object has already been added to the Area object, it will not be re-added.
1091:         if ($v !== null) {
1092:             $v->addDelivzone($this);
1093:         }
1094: 
1095: 
1096:         return $this;
1097:     }
1098: 
1099: 
1100:     /**
1101:      * Get the associated Area object
1102:      *
1103:      * @param PropelPDO $con Optional Connection object.
1104:      * @param $doQuery Executes a query to get the object if required
1105:      * @return Area The associated Area object.
1106:      * @throws PropelException
1107:      */
1108:     public function getArea(PropelPDO $con = null, $doQuery = true)
1109:     {
1110:         if ($this->aArea === null && ($this->area_id !== null) && $doQuery) {
1111:             $this->aArea = AreaQuery::create()->findPk($this->area_id, $con);
1112:             /* The following can be used additionally to
1113:                 guarantee the related object contains a reference
1114:                 to this object.  This level of coupling may, however, be
1115:                 undesirable since it could result in an only partially populated collection
1116:                 in the referenced object.
1117:                 $this->aArea->addDelivzones($this);
1118:              */
1119:         }
1120: 
1121:         return $this->aArea;
1122:     }
1123: 
1124:     /**
1125:      * Clears the current object and sets all attributes to their default values
1126:      */
1127:     public function clear()
1128:     {
1129:         $this->id = null;
1130:         $this->area_id = null;
1131:         $this->delivery = null;
1132:         $this->created_at = null;
1133:         $this->updated_at = null;
1134:         $this->alreadyInSave = false;
1135:         $this->alreadyInValidation = false;
1136:         $this->alreadyInClearAllReferencesDeep = false;
1137:         $this->clearAllReferences();
1138:         $this->resetModified();
1139:         $this->setNew(true);
1140:         $this->setDeleted(false);
1141:     }
1142: 
1143:     /**
1144:      * Resets all references to other model objects or collections of model objects.
1145:      *
1146:      * This method is a user-space workaround for PHP's inability to garbage collect
1147:      * objects with circular references (even in PHP 5.3). This is currently necessary
1148:      * when using Propel in certain daemon or large-volumne/high-memory operations.
1149:      *
1150:      * @param boolean $deep Whether to also clear the references on all referrer objects.
1151:      */
1152:     public function clearAllReferences($deep = false)
1153:     {
1154:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1155:             $this->alreadyInClearAllReferencesDeep = true;
1156:             if ($this->aArea instanceof Persistent) {
1157:               $this->aArea->clearAllReferences($deep);
1158:             }
1159: 
1160:             $this->alreadyInClearAllReferencesDeep = false;
1161:         } // if ($deep)
1162: 
1163:         $this->aArea = null;
1164:     }
1165: 
1166:     /**
1167:      * return the string representation of this object
1168:      *
1169:      * @return string
1170:      */
1171:     public function __toString()
1172:     {
1173:         return (string) $this->exportTo(DelivzonePeer::DEFAULT_STRING_FORMAT);
1174:     }
1175: 
1176:     /**
1177:      * return true is the object is in saving state
1178:      *
1179:      * @return boolean
1180:      */
1181:     public function isAlreadyInSave()
1182:     {
1183:         return $this->alreadyInSave;
1184:     }
1185: 
1186:     // timestampable behavior
1187: 
1188:     /**
1189:      * Mark the current object so that the update date doesn't get updated during next save
1190:      *
1191:      * @return     Delivzone The current object (for fluent API support)
1192:      */
1193:     public function keepUpdateDateUnchanged()
1194:     {
1195:         $this->modifiedColumns[] = DelivzonePeer::UPDATED_AT;
1196: 
1197:         return $this;
1198:     }
1199: 
1200: }
1201: 
thelia API documentation generated by ApiGen 2.8.0