Files
thetool/application/Product/Product.php
2021-07-05 19:46:22 +02:00

36 lines
818 B
PHP

<?php
class Product extends mfBaseModel {
private $productgroup;
private $producttech;
private $sla;
private $networks;
public function getProperty($name) {
if($this->$name == null) {
if($name == "networks") {
$this->networks = [];
$productNetworks = ProductNetworkModel::search(['product_id' => $this->id]);
foreach($productNetworks as $pnet) {
$this->networks[$pnet->network_id] = new Network($pnet->network_id);
}
return $this->networks;
}
$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;
}
}