Overview

Namespaces

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

Classes

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