You are here

protected function ConfigurationImportManager::normalizeConfigurations in Configuration Management 7.3

1 call to ConfigurationImportManager::normalizeConfigurations()
ConfigurationImportManager::import in src/Helpers/ConfigurationImportManager.php
Import configurations into the database.

File

src/Helpers/ConfigurationImportManager.php, line 95
ConfigurationExportManager.php handles the export of configurations.

Class

ConfigurationImportManager

Namespace

Configuration\Helpers

Code

protected function normalizeConfigurations() {
  $configurations_on_filesystem = array();

  // Foreach configuration defined in configurations.json:
  // - Check if it is duplicated in several groups.
  // - Reorganize it using the identifier as main key
  foreach ($this->configuration_list
    ->getConfigurations() as $group => $configurations) {
    foreach ($configurations as $identifier => $info) {
      if (!empty($configurations_on_filesystem[$identifier])) {
        $older_group = $configurations[$identifier]['group'];
        throw new \Exception("{$identifier} that belogns to {$group} was already defined in {$older_group}");
      }
      $configurations_on_filesystem[$identifier] = array(
        'group' => $group,
        'hash' => $info['hash'],
        'path' => $info['path'],
      );
    }
  }
  $this->configuration_on_filesystem = $configurations_on_filesystem;

  // Free memory
  $this->configuration_list
    ->reset();
}