You are here

protected function WebformSubmissionLogTrait::getSubmissionLog in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_submission_log/tests/src/Traits/WebformSubmissionLogTrait.php \Drupal\Tests\webform_submission_log\Traits\WebformSubmissionLogTrait::getSubmissionLog()

Get the entire submission log.

Return value

int The last submission id.

1 call to WebformSubmissionLogTrait::getSubmissionLog()
WebformSubmissionLogTest::testSubmissionLog in modules/webform_submission_log/tests/src/Functional/WebformSubmissionLogTest.php
Test webform submission log.

File

modules/webform_submission_log/tests/src/Traits/WebformSubmissionLogTrait.php, line 49

Class

WebformSubmissionLogTrait
Trait for webform submission log tests.

Namespace

Drupal\Tests\webform_submission_log\Traits

Code

protected function getSubmissionLog() {
  $query = \Drupal::database()
    ->select('webform_submission_log', 'l');
  $query
    ->leftJoin('webform_submission', 'ws', 'l.sid = ws.sid');
  $query
    ->fields('l', [
    'lid',
    'uid',
    'sid',
    'handler_id',
    'operation',
    'message',
    'variables',
    'timestamp',
  ]);
  $query
    ->fields('ws', [
    'webform_id',
    'entity_type',
    'entity_id',
  ]);
  $query
    ->orderBy('l.lid', 'DESC');
  $submission_logs = $query
    ->execute()
    ->fetchAll();
  foreach ($submission_logs as &$submission_log) {
    $submission_log->variables = unserialize($submission_log->variables);
  }
  return $submission_logs;
}