Added Buildings
This commit is contained in:
42
application/Building/Building.php
Normal file
42
application/Building/Building.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class Building extends mfBaseModel {
|
||||
private $network;
|
||||
private $pop;
|
||||
private $type;
|
||||
private $status;
|
||||
private $pipeworker;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "type") {
|
||||
$this->type = new Buildingtype($this->type_id);
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
if($name == "status") {
|
||||
$this->status = new Buildingstatus($this->status_id);
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
if($name == "pipeworker") {
|
||||
$this->pipeworker = new Address($this->pipeworker_id);
|
||||
return $this->pipeworker;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user