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