コード例 #1
0
ファイル: Model.php プロジェクト: 9naQuame/wyf
 public function update($field, $value)
 {
     $this->datastore->beginTransaction();
     $resolve = $this->queryResolve;
     $explicitRelations = $this->queryExplicitRelations;
     $this->queryResolve = false;
     $this->queryExplicitRelations = false;
     if (ENABLE_AUDIT_TRAILS === true && $this->disableAuditTrails === false) {
         $before = reset($this->getWithField2($field, $value));
     }
     $this->queryResolve = $resolve;
     $this->queryExplicitRelations = $explicitRelations;
     $this->preUpdateHook($field, $value);
     $this->datastore->setData($this->datastore->data, $this->fields);
     $this->updateImplementation($field, $value);
     $this->postUpdateHook();
     if (ENABLE_AUDIT_TRAILS === true && $this->disableAuditTrails === false) {
         $data = json_encode(array("after" => $this->datastore->data, "before" => $before));
         if ($this->datastore->tempData[0][$this->getKeyField()] == null) {
             $id = $before[$this->getKeyField()];
         } else {
             $id = $this->datastore->tempData[0][$this->getKeyField()];
         }
         SystemAuditTrailModel::log(array('item_id' => $id, 'item_type' => $this->package, 'description' => 'Updated item', 'type' => SystemAuditTrailModel::AUDIT_TYPE_UPDATED_DATA, 'data' => $data));
     }
     $this->datastore->endTransaction();
 }
コード例 #2
0
ファイル: Model.php プロジェクト: ekowabaka/wyf
 public function update($field, $value)
 {
     $this->datastore->beginTransaction();
     $resolve = $this->queryResolve;
     $explicitRelations = $this->queryExplicitRelations;
     $this->queryResolve = false;
     $this->queryExplicitRelations = false;
     $before = SystemAuditTrailModel::getPreUpdateData($this, $field, $value);
     $this->queryResolve = $resolve;
     $this->queryExplicitRelations = $explicitRelations;
     $this->preUpdateHook($field, $value);
     $this->datastore->setData($this->datastore->data, $this->fields);
     $this->updateImplementation($field, $value);
     $this->postUpdateHook();
     SystemAuditTrailModel::logUpdate($this, $before);
     $this->datastore->endTransaction();
 }