Files
thetool/application/Producttech/Producttech.php
2025-01-24 15:04:24 +01:00

42 lines
980 B
PHP

<?php
class Producttech extends mfBaseModel {
private $attributes;
protected function beforeUpdate($data) {
if(!array_key_exists("edit_by", $data)) {
$me = new User();
$me->loadMe();
$data["edit_by"] = $me->id;
}
return $data;
}
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;
}
}