You are here

public function ConfigManager::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::__construct()

Creates ConfigManager objects.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

\Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager: The typed config manager.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation service.

\Drupal\Core\Config\StorageInterface $active_storage: The active configuration storage.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

File

core/lib/Drupal/Core/Config/ConfigManager.php, line 106

Class

ConfigManager
The ConfigManager provides helper functions for the configuration system.

Namespace

Drupal\Core\Config

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config_manager, TranslationInterface $string_translation, StorageInterface $active_storage, EventDispatcherInterface $event_dispatcher, EntityRepositoryInterface $entity_repository = NULL) {
  if ($entity_type_manager instanceof EntityManagerInterface) {
    @trigger_error('Passing the entity.manager service to ConfigManager::__construct() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Pass the new dependencies instead. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityTypeManager = \Drupal::entityTypeManager();
  }
  else {
    $this->entityTypeManager = $entity_type_manager;
  }
  $this->configFactory = $config_factory;
  $this->typedConfigManager = $typed_config_manager;
  $this->stringTranslation = $string_translation;
  $this->activeStorage = $active_storage;
  $this->eventDispatcher = $event_dispatcher;
  if ($entity_repository) {
    $this->entityRepository = $entity_repository;
  }
  else {
    @trigger_error('The entity.repository service must be passed to ConfigManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityRepository = \Drupal::service('entity.repository');
  }
}