order = $order; $this->discount = $discount; parent::__construct($weight); } function getKey() { return $this->discount->getCode(); } /** * @return mixed * @throws \app\common\exceptions\AppException */ function getPrice() { return max($this->order->getPriceBefore($this->getKey()) - $this->discount->getAmount(),0); } }