32 lines
748 B
PHP
32 lines
748 B
PHP
<?php
|
|
|
|
class Producttech extends mfBaseModel {
|
|
private $attributes;
|
|
|
|
public function getProperty($name) {
|
|
if($this->$name == null) {
|
|
|
|
if($name == "attributes") {
|
|
$this->attributes = [];
|
|
$producttechAttributes = ProducttechAttributeModel::search(['producttech_id' => $this->id]);
|
|
foreach($producttechAttributes as $pta) {
|
|
$this->attributes[$pta->id] = $pta;
|
|
}
|
|
return $this->attributes;
|
|
}
|
|
|
|
|
|
$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;
|
|
}
|
|
} |