You are here

public function WebformProtectedDownloadsManager::getSubmissionByUuid in Webform Protected Downloads 8

Function will search submission by uuid.

Parameters

string $uuid: Uuid.

Return value

mixed Return value or FALSE.

Overrides WebformProtectedDownloadsManagerInterface::getSubmissionByUuid

File

src/WebformProtectedDownloadsManager.php, line 46

Class

WebformProtectedDownloadsManager
Class WebformProtectedDownloadsManager.

Namespace

Drupal\webform_protected_downloads

Code

public function getSubmissionByUuid($uuid) {

  // Get all WebformProtectedDownloads.
  $webformProtectedDownloadEntities = WebformProtectedDownloads::loadMultiple();
  foreach ($webformProtectedDownloadEntities as $entity) {

    // Get WebformSubmission.
    $webformSubmission = $entity
      ->getWebformSubmission();

    // Compare uuid's.
    if ($webformSubmission
      ->uuid() == $uuid) {

      // Return WebformProtectedDownload.
      return $entity;
    }
    continue;
  }
  return FALSE;
}