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

48 lines
1000 B
PHP

<?php
class OrderJournal extends mfBaseModel {
private $order;
private $creator;
private $editor;
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(!$this->id) {
return null;
}
if($name == "creator") {
$this->creator = new User($this->create_by);
return $this->creator;
}
if($name == "editor") {
$this->editor = new User($this->edit_by);
return $this->editor;
}
$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;
}
}