You are here

public function WebformEntityStorage::getMaxSerial in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformEntityStorage.php \Drupal\webform\WebformEntityStorage::getMaxSerial()

Returns a webform's max serial number.

Parameters

\Drupal\webform\WebformInterface $webform: A webform.

Return value

int The next serial number.

Overrides WebformEntityStorageInterface::getMaxSerial

1 call to WebformEntityStorage::getMaxSerial()
WebformEntityStorage::getSerial in src/WebformEntityStorage.php
Returns the next serial number for a webform's submission.

File

src/WebformEntityStorage.php, line 275

Class

WebformEntityStorage
Storage controller class for "webform" configuration entities.

Namespace

Drupal\webform

Code

public function getMaxSerial(WebformInterface $webform) {
  $query = $this->database
    ->select('webform_submission');
  $query
    ->condition('webform_id', $webform
    ->id());
  $query
    ->addExpression('MAX(serial)');
  return $query
    ->execute()
    ->fetchField() + 1;
}