Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

Classes

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