You are here

public function DomainAlias::getDomain in Domain Access 8

Get the parent domain entity for an alias record.

Return value

\Drupal\domain\Entity\Domain The parent domain for the alias record or NULL if not set.

Overrides DomainAliasInterface::getDomain

File

domain_alias/src/Entity/DomainAlias.php, line 116

Class

DomainAlias
Defines the domain alias entity.

Namespace

Drupal\domain_alias\Entity

Code

public function getDomain() {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('domain');
  $domains = $storage
    ->loadByProperties([
    'domain_id' => $this->domain_id,
  ]);
  return $domains ? current($domains) : NULL;
}