Finished Addressattribute

This commit is contained in:
Frank Schubert
2021-06-24 20:07:02 +02:00
parent 1b4226f762
commit 1c6acca834
5 changed files with 169 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
class Address extends mfBaseModel {
protected $forcestr = ['company','zip','phone','fax','mobile','note'];
private $types;
private $attributes;
public function getFullName() {
// Assumes "Firma1 Firma2" or "firstname lastname" as readable form
@@ -44,6 +44,17 @@ class Address extends mfBaseModel {
return $this->types;
}
if($name == "attributes") {
$attribs = AddressattributeModel::search(['address_id' => $this->id]);
if(count($attribs)) {
$this->attributes = [];
foreach($attribs as $a) {
$this->attributes[$a->name] = $a;
}
}
return $this->attributes;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);