You are here

public function StateFlow::persist in State Machine 7

Same name and namespace in other branches
  1. 6 modules/state_flow/plugins/state_flow.inc \StateFlow::persist()
  2. 7.2 modules/state_flow/plugins/state_flow.inc \StateFlow::persist()

Persist the current state to the object storage.

Overrides StateMachine::persist

1 call to StateFlow::persist()
StateFlow::fire_event in modules/state_flow/plugins/state_flow.inc
Extending fire_event() from state_machine's base.inc to add uid and log arguments.

File

modules/state_flow/plugins/state_flow.inc, line 131

Class

StateFlow

Code

public function persist() {
  $vid = $this->object->vid;
  $nid = $this->object->nid;
  $data = new stdClass();
  $data->vid = $vid;
  $data->nid = $nid;
  $data->state = $this
    ->get_current_state();
  $data->timestamp = REQUEST_TIME;
  $data->status = 1;
  $update = $this
    ->existing_revision($nid, $vid) ? array(
    'vid',
  ) : array();
  return drupal_write_record('node_revision_states', $data, $update);
}