public function WebformSubmissionStorage::getMaxSubmissionId in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::getMaxSubmissionId()
Get the maximum sid.
Parameters
\Drupal\webform\WebformInterface|null $webform: (optional) A webform. If set the total number of submissions for the Webform will be returned.
\Drupal\Core\Entity\EntityInterface|null $source_entity: (optional) A webform submission source entity.
\Drupal\Core\Session\AccountInterface|null $account: (optional) A user account.
Return value
int Total number of submissions.
Overrides WebformSubmissionStorageInterface::getMaxSubmissionId
File
- src/
WebformSubmissionStorage.php, line 291
Class
- WebformSubmissionStorage
- Defines the webform submission storage.
Namespace
Drupal\webformCode
public function getMaxSubmissionId(WebformInterface $webform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL) {
$query = $this
->getQuery();
$query
->accessCheck(FALSE);
$this
->addQueryConditions($query, $webform, $source_entity, $account);
$query
->sort('sid', 'DESC');
$query
->range(0, 1);
$result = $query
->execute();
return reset($result);
}