Example #1
0
 /**
  * Adds a collection of Bf_CouponDiscounts to this Bf_Coupon model.
  * @param string_ENUM['percentageDiscount', 'cashDiscount', 'unitsFree'] Nature of the discount being conferred.
  ***
  *  <percentageDiscount>
  *  Discounts from the price of the specified pricing component: a percentage.
  *  Example: $amount = 31 // 31% discount
  *
  *  <cashDiscount>
  *  Discounts from the price of the specified pricing component: a lump sum.
  *  Example: $amount = 31 // $31 discount
  *
  *  <unitsFree>
  *  Discounts from the price of the specified pricing component: a quantity of units.
  *  Example: $amount = 31 // 31 ice creams free
  ***
  * @param union[string ($id | $name) | Bf_PricingComponent $entity] The pricing component to which the discount is applied. <string>: ID or name of the Bf_PricingComponent. <Bf_PricingComponent>: The Bf_PricingComponent.
  * @param number The magnitude of the discount being conferred.
  * @return Bf_Coupon The modified coupon model.
  */
 protected function addDiscount($discountNature, $pricingComponent, $amount)
 {
     if (!$this->discounts) {
         $this->discounts = array();
     }
     $newDiscount = Bf_CouponDiscount::construct($discountNature, $pricingComponent, $amount);
     array_push($this->discounts, $newDiscount);
     return $this;
 }
Example #2
0
 public static function initStatics()
 {
     self::$_resourcePath = new Bf_ResourcePath('coupons', 'CouponDiscount');
 }