Switched Preorder building source to AddressDB

This commit is contained in:
Frank Schubert
2022-09-08 14:58:18 +02:00
parent 490e729f69
commit c7bd7ea8f3
13 changed files with 724 additions and 243 deletions

View File

@@ -1,7 +1,8 @@
<?php
class ADBStrasse extends mfBaseModel {
public $gemeinde = [];
private $ortschaft;
private $gemeinde;
protected function init() {
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
@@ -9,7 +10,35 @@ class ADBStrasse extends mfBaseModel {
}
public function afterLoad() {
$this->gemeinde = new ADBGemeinde($this->gemeinde_id);
//$this->gemeinde = new ADBGemeinde($this->gemeinde_id);
}
public function getProperty($name) {
if($this->$name == null) {
if($name == "ortschaft") {
$this->ortschaft = new ADBOrtschaft($this->ortschaft_id);
return $this->ortschaft;
}
if($name == "gemeinde") {
$this->gemeinde = new ADBGemeinde($this->gemeinde_id);
return $this->gemeinde;
}
$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;
}
}