throw new ConfigDuplicateUUIDException("Attempt to save a configuration entity '{
$this->
id()}' with UUID '{
$this->
uuid()}' when this UUID is already used for '
$matched_entity'"
);
} // If this entity is not new, load the original entity for comparison.
if (!
$this->
isNew()) { $original =
$storage->
loadUnchanged($this->
getOriginalId());
// Ensure that the UUID cannot be changed for an existing entity.
if ($original && ($original->
uuid() !=
$this->
uuid())) { throw new ConfigDuplicateUUIDException("Attempt to save a configuration entity '{
$this->
id()}' with UUID '{
$this->
uuid()}' when this entity already exists with UUID '{
$original->
uuid()}'"
);
} } if (!
$this->
isSyncing()) { // Ensure the correct dependencies are present. If the configuration is
// being written during a configuration synchronization then there is no
// need to recalculate the dependencies.
$this->
calculateDependencies();
// If the data is trusted we need to ensure that the dependencies are
// sorted as per their schema. If the save is not trusted then the
// configuration will be sorted by StorableConfigBase.
if ($this->trustedData
) { $mapping =
['config' => 0, 'content' => 1, 'module' => 2, 'theme' => 3, 'enforced' => 4
];
$dependency_sort =
function D
$dependencies) use ($mapping) { // Only sort the keys that exist.