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