You are here

protected function WebformSubmissionForm::getLastSubmission in Webform 8.5

Get last completed webform submission for the current user.

Parameters

bool $completed: Flag to get last completed or draft submission.

Return value

\Drupal\webform\WebformSubmissionInterface|null The last completed webform submission for the current user.

Deprecated

Scheduled for removal in Webform 8.x-6.x Use $this->getStorage()->getLastSubmission instead.

File

src/WebformSubmissionForm.php, line 3035

Class

WebformSubmissionForm
Provides a webform to collect and edit submissions.

Namespace

Drupal\webform

Code

protected function getLastSubmission($completed = TRUE) {
  $webform = $this
    ->getWebform();
  $source_entity = $this
    ->getSourceEntity();
  $account = $this
    ->getEntity()
    ->getOwner();
  $options = $completed ? [
    'in_draft' => FALSE,
  ] : [];
  return $this
    ->getStorage()
    ->getLastSubmission($webform, $source_entity, $account, $options);
}