/** * Create Discount, with applicable DiscountConditions */ static function createDiscountFromEntity($entity) { $discount = new Discount(); $discount->setId($entity->getId())->setName($entity->getName())->setAs($entity->getAppliedAs())->setTo($entity->getAppliedTo())->setValue($entity->getValue())->setIsPreTax($entity->getIsPreTax())->setIsAuto($entity->getIsAuto())->setCouponCode($entity->getCouponCode()); //TODO: build discount conditions return $discount; }