71 lines
1.5 KiB
PHP
71 lines
1.5 KiB
PHP
<?php
|
|
|
|
class Order extends mfBaseModel {
|
|
private $owner;
|
|
private $billingaddress;
|
|
private $creator;
|
|
private $editor;
|
|
|
|
public function getProperty($name) {
|
|
if($this->$name == null) {
|
|
|
|
if($name == "owner") {
|
|
if($this->id) {
|
|
$this->owner = new Address($this->owner_id);
|
|
return $this->owner;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
if($name == "contact") {
|
|
if($this->id) {
|
|
$this->contact = new Address($this->contact_id);
|
|
return $this->contact;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
if($name == "billingaddress") {
|
|
if($this->id) {
|
|
$this->billingaddress = new Address($this->billingaddress_id);
|
|
return $this->billingaddress;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
if($name == "creator") {
|
|
if($this->id) {
|
|
$this->creator = new User($this->create_by);
|
|
return $this->creator;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
if($name == "editor") {
|
|
if($this->id) {
|
|
$this->editor = new User($this->edit_by);
|
|
return $this->editor;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
$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;
|
|
}
|
|
|
|
} |