_model = new OrderModel(); } //Porduct모델 final public function getProductModel(): ProductModel { return is_null($this->_productModel) ? new ProductModel() : $this->_productModel; } //Field별 Form Option용 public function getFieldFormOption(string $field): array { switch ($field) { case 'product_uid': $options = $this->_product_uids = $this->_product_uids ?: $this->getProductModel()->getFieldFormOptions([]); break; default: return parent::getFieldFormOption($field); break; } if (!is_array($options)) { throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 Field:{$field}의 FormOptionData가 array가 아닙니다.\n" . var_export($options, true)); } return $options; } //장바구니에 담기 및 Product 재고 차감 public function addCart(ProductEntity $product, int $quantity, int $price): OrderEntity { return $this->_model->addCart($product, $quantity, $price); } }