$name == null) { if($name == "campaign") { $this->campaign = new Preordercampaign($this->id); return $this->campaign; } if($name == "partner") { $this->partner = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->partner_id); if(!$this->partner) { $this->partner = new Address($this->partner_id); if($this->partner->id) { mfValuecache::singleton()->set("mfObjectmodel-Address-".$this->partner_id, $this->partner); } } return $this->partner; } if($name == "building") { $this->building = mfValuecache::singleton()->get("mfObjectmodel-Building-".$this->building_id); if(!$this->building) { $this->building = new Building($this->building_id); if($this->building->id) { mfValuecache::singleton()->set("mfObjectmodel-Building-".$this->building_id, $this->building); } } return $this->building; } 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; } }