function EntityTestUuidId::generateUuid

Statically generates a UUID.

Return value

string A newly generated UUID.

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUuidId.php, line 73

Class

EntityTestUuidId
Defines a test entity class with UUIDs as IDs.

Namespace

Drupal\entity_test\Entity

Code

public static function generateUuid() : string {
  $uuid = \Drupal::service('uuid');
  assert($uuid instanceof UuidInterface);
  return $uuid->generate();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.