Overview

Namespaces

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

Classes

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