protected function WebformSubmissionLogTrait::getLastSubmissionLog in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_submission_log/tests/src/Traits/WebformSubmissionLogTrait.php \Drupal\Tests\webform_submission_log\Traits\WebformSubmissionLogTrait::getLastSubmissionLog()
Get the last submission id.
Return value
int The last submission id.
2 calls to WebformSubmissionLogTrait::getLastSubmissionLog()
- WebformSubmissionLogNodeTest::testSubmissionLog in modules/
webform_submission_log/ tests/ src/ Functional/ WebformSubmissionLogNodeTest.php - Tests webform submission log.
- 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 16
Class
- WebformSubmissionLogTrait
- Trait for webform submission log tests.
Namespace
Drupal\Tests\webform_submission_log\TraitsCode
protected function getLastSubmissionLog() {
$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');
$query
->range(0, 1);
$submission_log = $query
->execute()
->fetch();
if ($submission_log) {
$submission_log->variables = unserialize($submission_log->variables);
}
return $submission_log;
}