order = $order; $this->order->orderFreightDeduction->push($this); } /** * @return array */ public function toArray() { $this->code = (string)$this->code; $this->name = (string)$this->name; $this->amount = sprintf('%.2f', $this->amount); $this->coin = sprintf('%.2f', $this->coin); return parent::toArray(); } /** * @return bool */ public function beforeSaving() { // if (!$this->isChecked()) { // return false; // } $this->code = (string)$this->code; $this->name = (string)$this->name; $this->amount = sprintf('%.2f', $this->amount); $this->coin = sprintf('%.2f', $this->coin); return parent::beforeSaving(); } }