You are here

public function SerialSQLStorage::createStorageName in Serial Field 8

Creates the storage name.

Parameters

string $entityTypeId: Entity type id.

string $entityBundle: Entity bundle (entity type) name.

string $fieldName: Field name.

Return value

string Storage name.

Overrides SerialStorageInterface::createStorageName

2 calls to SerialSQLStorage::createStorageName()
SerialSQLStorage::createStorageNameFromField in src/SerialSQLStorage.php
Creates the assistant storage name for a specific field.
SerialSQLStorage::initOldEntries in src/SerialSQLStorage.php
Initializes the value of a new serial field in existing entities.

File

src/SerialSQLStorage.php, line 58

Class

SerialSQLStorage
Serial storage service definition.

Namespace

Drupal\serial

Code

public function createStorageName($entityTypeId, $entityBundle, $fieldName) {

  // To make sure we don't end up with table names longer than 64 characters,
  // which is a MySQL limit we hash a combination of fields.
  // @todo Think about improvement for this.
  $tableName = 'serial_' . md5("{$entityTypeId}_{$entityBundle}_{$fieldName}");
  return Database::getConnection()
    ->escapeTable($tableName);
}