45 lines
1017 B
PHP
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;
|
|
}
|
|
}
|