Added Statusflags in AddressDB
This commit is contained in:
@@ -1,16 +1,39 @@
|
||||
<?php
|
||||
|
||||
class PreorderStatusflagValue extends mfBaseModel {
|
||||
private $preorder;
|
||||
|
||||
protected function afterSave() {
|
||||
if($this->_old_data->value != $this->value) {
|
||||
if(!property_exists($this->_old_data, "value") || $this->_old_data->value != $this->data->value) {
|
||||
$history = PreorderHistoryModel::create([
|
||||
"preorder_id" => $this->preorder_id,
|
||||
"key" => "preorderstatusflag-".$this->flag_id."-value",
|
||||
"old_value" => $this->_old_data->value,
|
||||
"preorder_id" => $this->data->preorder_id,
|
||||
"key" => "preorderstatusflag-".$this->data->flag_id."-value",
|
||||
"old_value" => property_exists($this->_old_data, "value") ? $this->_old_data->value : null,
|
||||
"new_value" => $this->data->value
|
||||
]);
|
||||
$history->save();
|
||||
$this->getProperty("preorder")->afterSave();
|
||||
}
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user