setDiscounts example


    public function testPromotionHasDiscountYes(): void
    {
        $discount = new PromotionDiscountEntity();
        $discount->setId('D1');

        $promotion = new PromotionEntity();
        $promotion->setDiscounts(new PromotionDiscountCollection([$discount]));

        static::assertTrue($promotion->hasDiscount());
    }
}
$first = $data[0];

        $group->setId((int) $first['__priceGroup_id']);
        $group->setName($first['__priceGroup_description']);

        $discounts = [];
        foreach ($data as $row) {
            $discounts[] = $this->hydratePriceDiscount($row);
        }

        $group->setDiscounts($discounts);

        return $group;
    }

    /** * @return PriceDiscount */
    public function hydratePriceDiscount(array $data)
    {
        $discount = new PriceDiscount();
        $discount->setId((int) $data['__priceGroupDiscount_id']);
        
Home | Imprint | This part of the site doesn't use cookies.