43 lines
937 B
PHP
43 lines
937 B
PHP
<?php
|
|
|
|
class ProducttechAttribute extends mfBaseModel {
|
|
private $producttech;
|
|
private $contractval;
|
|
private $contract_id;
|
|
|
|
|
|
public function setContractId($contract_id) {
|
|
if(!is_numeric($contract_id)) {
|
|
return false;
|
|
}
|
|
$this->contract_id = $contract_id;
|
|
return true;
|
|
}
|
|
|
|
public function getProperty($name) {
|
|
if($this->$name == null) {
|
|
|
|
if($name == "contractval") {
|
|
if(!$this->contract_id) {
|
|
return null;
|
|
}
|
|
$this->contractval = ContractconfigValueModel::getFirst(['item_id' => $this->id]);
|
|
//var_dump($this->contractval);
|
|
return $this->contractval;
|
|
}
|
|
|
|
$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;
|
|
}
|
|
|
|
} |