You are here

public function ExecutionState::autoSave in Rules 8.3

Saves all variables that have been marked for auto saving.

Return value

$this

Overrides ExecutionStateInterface::autoSave

File

src/Context/ExecutionState.php, line 194

Class

ExecutionState
The rules execution state.

Namespace

Drupal\rules\Context

Code

public function autoSave() {

  // Make changes permanent.
  foreach ($this->saveLater as $selector => $flag) {
    $typed_data = $this
      ->fetchDataByPropertyPath($selector);

    // Things that can be saved must have a save() method, right?
    // Saving is always done at the root of the typed data tree, for example
    // on the entity level.
    $typed_data
      ->getRoot()
      ->getValue()
      ->save();
  }
  return $this;
}