Overview

Namespaces

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

Classes

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