Files
thetool/application/ADBHausnummer/ADBHausnummer.php
2022-09-08 14:58:18 +02:00

45 lines
1017 B
PHP

<?php
class ADBHausnummer extends mfBaseModel {
private $strasse;
private $plz;
protected function init() {
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
$this->table = "Hausnummer";
}
public function afterLoad() {
//$this->strasse = new ADBStrasse($this->strasse_id);
//$this->plz = new ADBPlz($this->plz_id);
}
public function getProperty($name) {
if($this->$name == null) {
if($name == "strasse") {
$this->strasse = new ADBStrasse($this->strasse_id);
return $this->strasse;
}
if($name == "plz") {
$this->plz = new ADBPlz($this->plz_id);
return $this->plz;
}
$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;
}
}