$name == null) { if($name == "value") { if(!$this->preorder_id) return null; $value = mfValuecache::singleton()->get("mfObjectmodel-PreorderStatusflagValue-{$this->code}-".$this->preorder_id); if(!$value) { $value = PreorderStatusflagValueModel::getFirst(["preorder_id" => $this->preorder_id, "flag_id" => $this->id]); if (!$value) { $value = PreorderStatusflagValueModel::create([ "preorder_id" => $this->preorder_id, "flag_id" => $this->id ]); } } mfValuecache::singleton()->set("mfObjectmodel-PreorderStatusflagValue-{$this->code}-".$this->preorder_id, $value); $this->value = $value; return $this->value; } if($name == "creator") { $user = mfValuecache::singleton()->get("Worker-id-".$this->create_by); if($user) { $this->creator = $user; return $this->creator; } $this->creator = new User($this->create_by); if($this->creator->id) { mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); } return $this->creator; } if($name == "editor") { $this->editor = new User($this->edit_by); return $this->editor; } $classname = ucfirst($name); $idfield = $name."_id"; $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); if(!$this->$name) { $this->$name = new $classname($this->$idfield); } if($this->$name->id) { mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); return $this->$name; } else { return null; } } return $this->$name; } }