Files
thetool/application/Network/Network.php
Frank Schubert 8f4e179315 Added adding POPs
2021-06-29 20:57:24 +02:00

42 lines
868 B
PHP

<?php
class Network extends mfBaseModel {
private $owner;
private $pops;
public function getProperty($name) {
if($this->$name == null) {
if($name == "owner") {
if($this->id) {
$this->owner = new Address($this->owner_id);
return $this->owner;
} else {
return null;
}
}
if($name == "pops") {
if($this->id) {
$pops = PopModel::search(['network_id' => $this->id]);
$this->pops = $pops;
return $this->pops;
} else {
return null;
}
}
$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;
}
}