Added PreorderStatusflag to Preorder/Index

This commit is contained in:
Frank Schubert
2024-07-29 14:44:08 +02:00
parent 44483cdaca
commit 4abaa50f56
7 changed files with 196 additions and 9 deletions

View File

@@ -1,5 +1,52 @@
<?php
class PreorderStatusflag extends mfBaseModel {
private $value;
public $preorder_id;
public function getProperty($name) {
if($this->$name == null) {
if($name == "value") {
if(!$this->preorder_id) return null;
$value = PreorderStatusflagValueModel::getFirst(["preorder_id" => $this->preorder_id, "flag_id" => $this->id]);
$this->value = $value;
return $this->value;
}
if($name == "creator") {
$user = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($user) {
$this->creator = $user;
return $this->creator;
}
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
}
return $this->creator;
}
if($name == "editor") {
$this->editor = new User($this->edit_by);
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
if(!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}