$name == null) { if(!$this->id) { return null; } if($name == "owner") { $this->owner = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->owner_id); if($this->owner === null) { $this->owner = new Address($this->owner_id); if($this->owner->id) { mfValuecache::singleton()->set("mfObjectmodel-Address-".$this->owner_id, $this->owner); } } return $this->owner; } if($name == "billingaddress") { $this->billingaddress = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->billingaddress_id); if($this->billingaddress === null) { $this->billingaddress = new Address($this->billingaddress_id); if($this->billingaddress->id) { mfValuecache::singleton()->set("mfObjectmodel-Address-".$this->billingaddress_id, $this->billingaddress); } } return $this->billingaddress; } if($name == "product") { $this->product = mfValuecache::singleton()->get("mfObjectmodel-Product-".$this->product_id); if($this->product === null) { $this->product = new Product($this->product_id); if($this->product->id) { mfValuecache::singleton()->set("mfObjectmodel-Product-".$this->product_id, $this->product); } } return $this->product; } if($name == "orderproduct") { $this->orderproduct = mfValuecache::singleton()->get("mfObjectmodel-OrderProduct-".$this->orderproduct_id); if($this->orderproduct === null) { $this->orderproduct = new OrderProduct($this->orderproduct_id); if($this->orderproduct->id) { mfValuecache::singleton()->set("mfObjectmodel-OrderProduct-".$this->orderproduct_id, $this->orderproduct); } } return $this->orderproduct; } if($name == "creator") { $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by); if($this->creator === null) { $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 = mfValuecache::singleton()->get("Worker-id-".$this->edit_by); if($this->editor === null) { $this->editor = new User($this->edit_by); if($this->editor->id) { mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor); } } 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; } }