ZoneMetadataService
class ZoneMetadataService (View source)
The zone metadata rules the editor and the API share: what a kind accepts, who may change it, what the active backend can store, and how a change is persisted and logged. Callers parse their input and word the refusals.
Constants
| SUPPORT_SUPPORTED |
|
| SUPPORT_UNSUPPORTED_KNOWN |
|
| SUPPORT_UNKNOWN |
|
| MAX_KIND_LENGTH |
|
Methods
No description
No description
Trim the submitted rows and drop the ones with no kind or no content, so an add/remove-row editor never produces an empty write.
The kinds whose value set differs between two snapshots.
Why the active store cannot hold this kind (a MetadataDefinitions::REJECT_* code), or null.
Whether the active store is known to take a version-gated kind: SUPPORT_* constants.
The zone's metadata rows, sorted by kind. In API mode the zone-object properties that stand in for metadata kinds are folded in.
Replace the zone's whole metadata set, as the editor does. Every row is checked first, then only the kinds that actually change are gated, so a value set out of band does not lock the editor out of the rest.
Set every value of one kind, as the API does.
Remove every value of one kind, as the API does.
The set with every row of one kind replaced by the given values.
Details
__construct(ZoneMetadataStoreInterface $store, ConfigurationInterface $config, PermissionService $permissions, AuditLoggerInterface $audit, RecordChangeWriterInterface $changeLogger, LoggerInterface|null $logger = null, ZoneCacheFlusherInterface|null $zoneCacheFlusher = null)
No description
static string
normalizeKind(string $kind)
No description
static array
normalizeRows(array $rows)
Trim the submitted rows and drop the ones with no kind or no content, so an add/remove-row editor never produces an empty write.
static array
changedKinds(array $submitted, array $current)
The kinds whose value set differs between two snapshots.
string|null
writeRejection(string $kind)
Why the active store cannot hold this kind (a MetadataDefinitions::REJECT_* code), or null.
string
kindSupport(array $definition, callable $capabilities)
Whether the active store is known to take a version-gated kind: SUPPORT_* constants.
array
load(int $zoneId, string $zoneName)
The zone's metadata rows, sorted by kind. In API mode the zone-object properties that stand in for metadata kinds are folded in.
ZoneMetadataResult
replaceAll(int $zoneId, string $zoneName, array $rows, int $actingUserId)
Replace the zone's whole metadata set, as the editor does. Every row is checked first, then only the kinds that actually change are gated, so a value set out of band does not lock the editor out of the rest.
ZoneMetadataResult
replaceKind(int $zoneId, string $zoneName, string $kind, array $values, int $actingUserId)
Set every value of one kind, as the API does.
ZoneMetadataResult
deleteKind(int $zoneId, string $zoneName, string $kind, int $actingUserId)
Remove every value of one kind, as the API does.
static array
replaceKindIn(array $rows, string $kind, array $values)
The set with every row of one kind replaced by the given values.