protected function DomainCommands::domainStorage in Domain Access 8
Gets a domain storage object or throw an exception.
Note that domain can run very early in the bootstrap, so we cannot reliably inject this service.
Return value
\Drupal\domain\DomainStorageInterface The domain storage handler.
Throws
\Drupal\domain\Commands\DomainCommandException
File
- domain/
src/ Commands/ DomainCommands.php, line 969
Class
- DomainCommands
- Drush commands for the domain module.
Namespace
Drupal\domain\CommandsCode
protected function domainStorage() {
if (!is_null($this->domainStorage)) {
return $this->domainStorage;
}
try {
$this->domainStorage = \Drupal::entityTypeManager()
->getStorage('domain');
} catch (PluginNotFoundException $e) {
throw new DomainCommandException('Unable to get domain: no storage', $e);
} catch (InvalidPluginDefinitionException $e) {
throw new DomainCommandException('Unable to get domain: bad storage', $e);
}
return $this->domainStorage;
}