FileStorageConfigurationWriter
Writes config/system/file-storages.yaml.
Changes are applied to the file as written on disk, not to the resolved configuration, so "%env()%" placeholders and "imports" of untouched entries are preserved. Callers pass compact entries; keys that carry the default value are omitted from the file.
Every change is validated against the resolved configuration, imports included, written atomically and verified after writing. A change that would leave an invalid configuration behind is rolled back.
The file is part of the deployment. Writing it is meant for command line tools, upgrade wizards and set up code, not for regular web requests.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Methods
- __construct() : mixed
- apply() : void
- Adds, replaces and removes several storages in one validated write, e.g.
- remove() : void
- Removes the storage with the given identifier from the file. Storages of imported files are refused, unknown identifiers are ignored.
- write() : void
- Adds or replaces the storage with the given identifier. When no storages are defined yet, the implicit default storage is written along.
- writeAll() : void
- Replaces all storage definitions. Refuses to overwrite a file that already defines storages, imports included, so a migration cannot destroy manual work.
Methods
__construct()
public
__construct(FileStorageConfiguration $configuration, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $configuration : FileStorageConfiguration
- $eventDispatcher : EventDispatcherInterface
apply()
Adds, replaces and removes several storages in one validated write, e.g.
public
apply(array<int, array<string, mixed>> $entries[, array<int, int> $removals = [] ]) : void
to move the default flag from one storage to another.
Parameters
- $entries : array<int, array<string, mixed>>
-
compact entries keyed by identifier
- $removals : array<int, int> = []
-
identifiers of storages to remove
Tags
remove()
Removes the storage with the given identifier from the file. Storages of imported files are refused, unknown identifiers are ignored.
public
remove(int $identifier) : void
Parameters
- $identifier : int
Tags
write()
Adds or replaces the storage with the given identifier. When no storages are defined yet, the implicit default storage is written along.
public
write(int $identifier, array $entry) : void
Parameters
- $identifier : int
- $entry : array
Tags
writeAll()
Replaces all storage definitions. Refuses to overwrite a file that already defines storages, imports included, so a migration cannot destroy manual work.
public
writeAll(array<int, array<string, mixed>> $storages) : void
Parameters
- $storages : array<int, array<string, mixed>>
-
compact entries keyed by identifier