You are here

public function Domain::createNumericId in Domain Access 8

Creates a unique numeric id for use in the {node_access} table.

Parameters

int $id: An integer to use as the numeric id.

1 call to Domain::createNumericId()
Domain::createDomainId in domain/src/Entity/Domain.php
Creates a unique domain id for this record.

File

domain/src/Entity/Domain.php, line 412

Class

Domain
Defines the domain entity.

Namespace

Drupal\domain\Entity

Code

public function createNumericId($id) {

  // Ensure that this value is unique.
  $storage = \Drupal::entityTypeManager()
    ->getStorage('domain');
  $result = $storage
    ->loadByProperties([
    'domain_id' => $id,
  ]);
  if (empty($result)) {
    $this->domain_id = $id;
  }
  else {
    $id++;
    $this
      ->createNumericId($id);
  }
}