You are here

public function SerialSQLStorage::generateValue in Serial Field 8

Generates a unique serial value (unique per entity bundle).

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition: Field definition.

\Drupal\Core\Entity\FieldableEntityInterface $entity: Entity.

bool $delete: Indicates if temporary records should be deleted.

Return value

int Unique serial id.

Overrides SerialStorageInterface::generateValue

File

src/SerialSQLStorage.php, line 106

Class

SerialSQLStorage
Serial storage service definition.

Namespace

Drupal\serial

Code

public function generateValue(FieldDefinitionInterface $fieldDefinition, FieldableEntityInterface $entity, $delete = TRUE) {
  $storageName = $this
    ->createStorageNameFromField($fieldDefinition, $entity);
  return $this
    ->generateValueFromName($storageName, $delete);
}