final class ShadowSavepoint

Everything a transaction would have to put back, as it was at one moment.

Rolling back is not only about rows: a statement inside a transaction may have created or dropped a table, and a rollback that restored the rows but not what the tables are would leave the shadow describing a database that never existed. Both are taken together, and put back together.

Properties§

public string|null $name

Methods§

public function __construct(
    public string|null $name,
    private ShadowStore $store,
    private TableDefinitionRegistry $registry,
)

Binds a savepoint to what it will put back.

Both are taken as they are, which means a caller that means to remember the shadow has to hand over copies of it; of() is what does that.

Parameters

$namestring|nullName the savepoint was declared under, or null for the transaction itself
$storeShadowStoreRows as they were
$registryTableDefinitionRegistryTables as they were
Test cases 6
public static function of(
    string|null $name,
    ShadowStore $store,
    TableDefinitionRegistry|null $registry,
): self
public function restoreInto(ShadowStore $store, TableDefinitionRegistry|null $registry): void

Puts the shadow back to what it was when the savepoint was taken.

Parameters

$storeShadowStoreRows to put back
$registryTableDefinitionRegistry|nullTables to put back, where anything is describing them
Test cases 3
Calls 1
public function isNamed(string $name): bool

Reports whether this is the savepoint declared under a name.

Parameters

$namestringName to test against

Returns

bool True when it was declared under that name
Test cases 2

Private surface 2§

Implementation details, listed for orientation only.

private ShadowStore $store
private TableDefinitionRegistry $registry

Test cases 9§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 6
Other tests reaching this symbol 3

Relations§

Static calls 2