get my_networks from parent address if exists

This commit is contained in:
Frank Schubert
2021-08-05 20:45:16 +02:00
parent c06bb156c7
commit c300830a06
4 changed files with 51 additions and 31 deletions

View File

@@ -6,6 +6,7 @@ class Network extends mfBaseModel {
private $addresstypes;
private $roles;
private $sections;
private $buildings;
public function getTypeAddresses($search_type) {
@@ -48,41 +49,34 @@ class Network extends mfBaseModel {
public function getProperty($name) {
if($this->$name == null) {
if(!$this->id) {
return null;
}
if($name == "owner") {
if($this->id) {
$this->owner = new Address($this->owner_id);
return $this->owner;
} else {
return null;
}
$this->owner = new Address($this->owner_id);
return $this->owner;
}
if($name == "pops") {
if($this->id) {
$pops = PopModel::search(['network_id' => $this->id]);
$this->pops = $pops;
return $this->pops;
} else {
return null;
}
$pops = PopModel::search(['network_id' => $this->id]);
$this->pops = $pops;
return $this->pops;
}
if($name == "addresstypes") {
if($this->id) {
$this->loadAddresstypes();
return $this->addresstypes;
} else {
return null;
}
$this->loadAddresstypes();
return $this->addresstypes;
}
if($name == "sections") {
if($this->id) {
$this->sections = NetworksectionModel::search(['network_id' => $this->id]);
return $this->sections;
} else {
return null;
}
$this->sections = NetworksectionModel::search(['network_id' => $this->id]);
return $this->sections;
}
if($name == "buildings") {
$this->buildings = BuildingModel::search(["network_id" => $this->id]);
return $this->buildings;
}
$classname = ucfirst($name);