SnapshotUpcasterChain
in package
FinalYes
Brings stored snapshots step by step to the current version (v1 → v2 → … → current).
Table of Contents
Methods
- __construct() : mixed
- default() : self
- Shared instance used by InvoiceData::fromSnapshot().
- documentDefault() : self
- Shared instance used by DocumentData::fromSnapshot(). Documents have their own versions.
- register() : self
- upcast() : array<string, mixed>
- useDefault() : void
- Replaces the shared instance of InvoiceData::fromSnapshot(); null resets it.
- useDocumentDefault() : void
- Replaces the shared instance of DocumentData::fromSnapshot(); null resets it.
Methods
__construct()
public
__construct([iterable<string|int, SnapshotUpcaster> $upcasters = [] ]) : mixed
Parameters
- $upcasters : iterable<string|int, SnapshotUpcaster> = []
default()
Shared instance used by InvoiceData::fromSnapshot().
public
static default() : self
Return values
selfdocumentDefault()
Shared instance used by DocumentData::fromSnapshot(). Documents have their own versions.
public
static documentDefault() : self
Return values
selfregister()
public
register(SnapshotUpcaster $upcaster) : self
Parameters
- $upcaster : SnapshotUpcaster
Return values
selfupcast()
public
upcast(array<string, mixed> $snapshot, int $from[, int $to = InvoiceData::SNAPSHOT_VERSION ]) : array<string, mixed>
Parameters
- $snapshot : array<string, mixed>
-
without the "_version" key
- $from : int
- $to : int = InvoiceData::SNAPSHOT_VERSION
Return values
array<string, mixed>useDefault()
Replaces the shared instance of InvoiceData::fromSnapshot(); null resets it.
public
static useDefault(self|null $chain) : void
Parameters
- $chain : self|null
useDocumentDefault()
Replaces the shared instance of DocumentData::fromSnapshot(); null resets it.
public
static useDocumentDefault(self|null $chain) : void
Parameters
- $chain : self|null