contract_id = $contract_id; return true; } public function getValue() { $value = $this->getProperty("value"); if(!$value) { return null; } if($this->multiple) { return json_decode($value->json); } if($this->type == "int") { return $value->int; } if($this->type == "decimal") { return $value->number; } return $value->string; } public function getTypedataArray() { if(!$this->typedata) { return []; } return explode("\n", $this->typedata); } public function getProperty($name) { if($this->$name == null) { if(!$this->id) { return null; } if($name == "value") { if(!$this->contract_id) { return null; } $value = ContractconfigValueModel::getFirst(['item_id' => $this->id, "contract_id" => $this->contract_id]); if(!$value) { $me = new User(); $me->loadMe(); $value = new ContractconfigValue(); $value->item_id = $this->id; $value->contract_id = $this->contract_id; $value->create_by = $me->id; $value->edit_by = $me->id; } //var_dump($value);exit; $this->value = $value; return $this->value; } $classname = ucfirst($name); $idfield = $name."_id"; $this->$name = new $classname($this->$idfield); if($this->$name->id) { return $this->$name; } else { return null; } } return $this->$name; } }