final class TableContext
Public API: explicitly declared with @visibility public.

Snapshots fixture values and schema metadata into the public transformer context contract.

Discover columns from fixture rowsdoctest
$store = new \ZtdQuery\Shadow\ShadowStore();
    $store->set('users', [['id' => 1]]);
    $tableContext = new \ZtdQuery\Platform\MySql\Rewrite\Context\TableContext(
        new \ZtdQuery\Platform\MySql\Rewrite\Cte\MySqlCteShadowComposer(),
        new \ZtdQuery\Schema\TableDefinitionRegistry(),
        $store,
        new \ZtdQuery\Schema\ViewDefinitionSet());
    $tableContext->buildTableContext()['users']['columns'] // => ['id']

Methods§

public function __construct(
    private MySqlCteShadowComposer $cteComposer,
    private TableDefinitionRegistry $registry,
    private ShadowStore $shadowStore,
    private ViewDefinitionSet $views,
)

Configure the dependencies used by this operation.

Parameters

public function buildTableContext(): array<string, array{viewSql: string}|array{rows: array<int, array<string, mixed>>, columns: array<int, string>, columnTypes: array<string, ColumnDeclaration>, columnDefaults: array<string, string>, identityStrategies: array<string, IdentityGenerationStrategy>, generatedExpressions: array<string, string>, partitioning: TablePartitioning|null}>

Build the table context map for transformers.

Returns

array<string, array{viewSql: string}|array{rows: array<int, array<string, mixed>>, columns: array<int, string>, columnTypes: array<string, ColumnDeclaration>, columnDefaults: array<string, string>, identityStrategies: array<string, IdentityGenerationStrategy>, generatedExpressions: array<string, string>, partitioning: TablePartitioning|null}>
Test cases 1
Called from 1
Calls 7
public function findUnknownTable(string $sql): ?string
public function tableExists(string $tableName): bool
public function requireKnownTables(string $sql): void

Private surface 4§

Implementation details, listed for orientation only.

private MySqlCteShadowComposer $cteComposer
private TableDefinitionRegistry $registry
private ShadowStore $shadowStore
private ViewDefinitionSet $views

Test cases 8§

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

Dedicated tests 5
Other tests reaching this symbol 3

Relations§

Instantiated in 2
Method calls 2