Skip to content
PHP Ecosystem
Explore

DbSnapshot

API reference › Debug Core › Panel › Db › DbSnapshot

final readonly classPHPForge\Debug\Panel\Db\DbSnapshot
ImplementsPHPForge\Debug\Storage\PanelSnapshot
Sourcesrc/Panel/Db/DbSnapshot.php

Canonical database panel snapshot holding the resolved query rows in their typed form.

MethodDescriptionDefined by
__construct()Creates a database snapshot from captured query rows.DbSnapshot
capture() staticResolves exact SQL duplicates while preserving capture order and the persisted row contract.DbSnapshot
entries()Returns the captured query rows.DbSnapshot
fromArray() staticNarrows the persisted database payload into a typed snapshot.DbSnapshot
jsonSerialize()Returns the panel snapshot for JSON serialization.DbSnapshot
public function __construct(list<PHPForge\Debug\Panel\Db\QueryRow> $entries)

Creates a database snapshot from captured query rows.

Parameters

ParameterTypeDescription
$entrieslist<QueryRow>
public static function capture(list<PHPForge\Debug\Panel\Db\QueryRow> $rows): self

Resolves exact SQL duplicates while preserving capture order and the persisted row contract.

Parameters

ParameterTypeDescription
$rowslist<QueryRow>

Returns

self

public function entries(): list<PHPForge\Debug\Panel\Db\QueryRow>

Returns the captured query rows.

Returns

list<QueryRow>: Executed statements in capture order.

public static function fromArray(mixed $data, string $path): self

Narrows the persisted database payload into a typed snapshot.

Parameters

ParameterTypeDescription
$datamixedPersisted payload, expected to be an object carrying an entries list.
$pathstringJSON path of the payload, used to report a malformed capture.

Returns

self: Snapshot carrying the persisted query rows.

public function jsonSerialize(): array<string, mixed>

Returns the panel snapshot for JSON serialization.

Returns

array<string, mixed>