final class UpdateTransformer
    implements SqlTransformer

Transforms UPDATE statements into SELECT projections with CTE shadowing.

Methods§

public function __construct(MySqlParser $parser, SelectTransformer $selectTransformer)

Configure the dependencies used by this operation.

Parameters

$parserMySqlParser
$selectTransformerSelectTransformer
Calls 1
public function transform(string $sql, array $tables): string

{@inheritDoc}

Parameters

$sqlstring
$tablesarray

Returns

string
Test cases 14
Called from 2
Calls 16
public function buildProjection(
    UpdateStatement $stmt,
    array<int, string> $columns,
    array<int, string> $primaryKeys = [],
    list<MultiTableMutationTarget> $targets = [],
    list<string> $assignmentValues = [],
    ?string $whereExpression = null,
    ?string $sourceExpression = null,
): array{sql: string, table: string, tables: array<string, array{alias: string}>}

Build a result-select SQL from an UPDATE statement.

Parameters

$stmtUpdateStatement
$columnsarray<int, string>
$primaryKeysarray<int, string>
$targetslist<MultiTableMutationTarget>
$assignmentValueslist<string>
$whereExpression?string
$sourceExpression?string

Returns

array{sql: string, table: string, tables: array<string, array{alias: string}>}

Throws

RuntimeException
Test cases 47
Called from 3
Calls 2

Private surface 3§

Implementation details, listed for orientation only.

private MySqlParser $parser
private SelectTransformer $selectTransformer
private MySqlCteShadowComposer $cteComposer

Test cases 302§

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

Dedicated tests 61
Other tests reaching this symbol 241

Relations§

Instantiated in 1
Method calls 3
Type declarations 5