You are here

public function ConfigUpdater::__construct in Commerce Core 8.2

Constructs a new ConfigUpdater object.

Parameters

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

\Drupal\Core\Config\StorageInterface $active_config_storage: The active config storage.

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

File

src/Config/ConfigUpdater.php, line 73

Class

ConfigUpdater
Default implementation of the ConfigUpdaterInterface.

Namespace

Drupal\commerce\Config

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, StorageInterface $active_config_storage, ConfigFactoryInterface $config_factory) {
  $this->entityTypeManager = $entity_type_manager;
  $this->activeConfigStorage = $active_config_storage;
  $this->extensionConfigStorage = new ExtensionInstallStorage($active_config_storage, InstallStorage::CONFIG_INSTALL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE, \Drupal::installProfile());
  $this->extensionOptionalConfigStorage = new ExtensionInstallStorage($active_config_storage, InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE, \Drupal::installProfile());
  $this->configFactory = $config_factory;
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type => $definition) {
    if ($definition
      ->entityClassImplements(ConfigEntityInterface::class)) {

      /** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $definition */
      $prefix = $definition
        ->getConfigPrefix();
      $this->typesByPrefix[$prefix] = $entity_type;
    }
  }
}