You are here

public function ConfigSyncServiceProvider::alter in Configuration Synchronizer 8.2

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceProviderBase::alter

File

src/ConfigSyncServiceProvider.php, line 14

Class

ConfigSyncServiceProvider

Namespace

Drupal\config_sync

Code

public function alter(ContainerBuilder $container) {

  // This service was introduced as a new dependency in config_sync
  // 8.x-2.0-beta2.
  // @see https://www.drupal.org/project/drupal/issues/2863986
  try {
    $container
      ->getDefinition('plugin.manager.config_normalizer');
  } catch (ServiceNotFoundException $exception) {

    // Requires 'plugin.manager.config_normalizer'.
    $container
      ->removeDefinition('config_sync.lister');

    // Both require 'config_sync.lister'.
    $container
      ->removeDefinition('config_sync.snapshotter');
    $container
      ->removeDefinition('config_sync.commands');

    // Requires config_sync.snapshotter.
    $container
      ->removeDefinition('config_sync_snapshot_subscriber');
  }
}