Overview

Namespaces

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

Classes

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