45 lines
1009 B
PHP
45 lines
1009 B
PHP
<?php
|
|
|
|
class ADBStrasse extends mfBaseModel {
|
|
private $ortschaft;
|
|
private $gemeinde;
|
|
|
|
protected function init() {
|
|
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
|
$this->table = "Strasse";
|
|
}
|
|
|
|
public function afterLoad() {
|
|
//$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;
|
|
}
|
|
|
|
}
|