$dependency_manager =
new ConfigDependencyManager();
$dependency_manager->
setData($config_to_create);
$config_to_create =
array_merge(array_flip($dependency_manager->
sortAll()),
$config_to_create);
if (!
empty($dependency)) { // In order to work out dependencies we need the full config graph.
$dependency_manager->
setData($this->
getActiveStorages()->
readMultiple($existing_config) +
$config_to_create);
$dependencies =
$dependency_manager->
getDependentEntities(key($dependency),
reset($dependency));
} foreach ($config_to_create as $config_name =>
$data) { // Remove configuration where its dependencies cannot be met.
$remove = !
$this->
validateDependencies($config_name,
$data,
$enabled_extensions,
$all_config);
// Remove configuration that is not dependent on $dependency, if it is
// defined.
if (!
$remove && !
empty($dependency)) { $remove = !
isset($dependencies[$config_name]);
} if ($remove) { // Remove from the list of configuration to create.
unset($config_to_create[$config_name]);
// Remove from the list of all configuration. This ensures that any
// configuration that depends on this configuration is also removed.