extended workflow cache

This commit is contained in:
Frank Schubert
2022-02-15 21:24:50 +01:00
parent 71862c3c85
commit 1406d55b56
2 changed files with 20 additions and 2 deletions

View File

@@ -79,6 +79,14 @@ class Building extends mfBaseModel {
return $code;
}
public function loadWorkflowItems() {
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
$item->setObjectId($this->id);
$this->workflowitems[$item->name] = $item;
mfValuecache::set("wfBuilding-".$item->name, $item);
}
}
public function getWorkflowvalue($itemname, $type = false) {
$item = mfValuecache::get("wfBuilding-".$itemname);
if(!$item) {
@@ -190,6 +198,7 @@ class Building extends mfBaseModel {
}
if($name == "workflowitems") {
$this->loadWorkflowItems();
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
$item->setObjectId($this->id);
$this->workflowitems[$item->name] = $item;

View File

@@ -35,6 +35,14 @@ class Termination extends mfBaseModel {
return $address;
}
public function loadWorkflowItems() {
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
$item->setObjectId($this->id);
$this->workflowitems[$item->name] = $item;
mfValuecache::set("wfTerm-".$item->name, $item);
}
}
public function getWorkflowvalue($itemname, $type = false) {
$item = mfValuecache::get("wfTerm-".$itemname);
if(!$item) {
@@ -239,10 +247,11 @@ class Termination extends mfBaseModel {
}
if($name == "workflowitems") {
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
$this->loadWorkflowItems();
/*foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
$item->setObjectId($this->id);
$this->workflowitems[$item->name] = $item;
}
}*/
//var_dump($this->workflowitems);exit;
return $this->workflowitems;
}