You are here

public function CountryRepository::__construct in Address 8

Creates a CountryRepository instance.

Parameters

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

File

src/Repository/CountryRepository.php, line 31

Class

CountryRepository
Defines the country repository.

Namespace

Drupal\address\Repository

Code

public function __construct(CacheBackendInterface $cache, LanguageManagerInterface $language_manager) {
  parent::__construct();
  $this->cache = $cache;

  // The getCurrentLanguage() fallback is a workaround for core bug #2684873.
  $language = $language_manager
    ->getConfigOverrideLanguage() ?: $language_manager
    ->getCurrentLanguage();
  $this->defaultLocale = $language
    ->getId();
}