You are here

public function SubmissionsCompletedSinceLastSuccess::onSuccess in Webform Scheduled Tasks 8.2

Called when a task is successful.

Overrides ResultSetPluginBase::onSuccess

File

src/Plugin/WebformScheduledTasks/ResultSet/SubmissionsCompletedSinceLastSuccess.php, line 90

Class

SubmissionsCompletedSinceLastSuccess
Get all submissions completed since the last successful run of the task.

Namespace

Drupal\webform_scheduled_tasks\Plugin\WebformScheduledTasks\ResultSet

Code

public function onSuccess() {

  // If the whole scheduled task was successful, store the time when the
  // latest submission was made, so we can query.
  $success_map = $this->state
    ->get(static::STATE_KEY, []);
  $success_map[$this
    ->getScheduledTask()
    ->id()] = $this->time
    ->getRequestTime();
  $this->state
    ->set(static::STATE_KEY, $success_map);
}