Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

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