db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME); $this->table = "Statusflag"; } public function getProperty($name) { if($this->$name == null) { if($name == "value") { if(!$this->hausnummer_id && !$this->wohneinheit_id) return null; if($this->hausnummer_id) { $value = ADBHausnummerStatusflagValueModel::getFirst(["hausnummer_id" => $this->hausnummer_id, "flag_id" => $this->id]); if(!$value) { $value = ADBHausnummerStatusflagValueModel::create([ "hausnummer_id" => $this->hausnummer_id, "flag_id" => $this->id ]); } } elseif($this->wohneinheit_id) { $value = ADBWohneinheitStatusflagValueModel::getFirst(["wohneinheit_id" => $this->wohneinheit_id, "flag_id" => $this->id]); if(!$value) { $value = ADBWohneinheitStatusflagValueModel::create([ "wohneinheit_id" => $this->wohneinheit_id, "flag_id" => $this->id ]); } } $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; } }