Added ProductNetwork

This commit is contained in:
Frank Schubert
2021-07-05 19:46:22 +02:00
parent c06c29530b
commit 110c3fe71d
8 changed files with 196 additions and 8 deletions
+13
View File
@@ -3,10 +3,23 @@
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);