classReplaceMutation
final class ReplaceMutation
implements DataMutation
Applies REPLACE INTO operation to the shadow store. REPLACE deletes the existing row and inserts the new one.
Methods§
public function __construct(
string $tableName,
array<int, string> $primaryKeys = [],
CandidateKeySet|null $candidateKeys = null,
)Parameters
$tableName | string | Target table. |
$primaryKeys | array<int, string> | Primary key columns. |
$candidateKeys | CandidateKeySet|null | Candidate keys used for conflict detection. |
Test cases 8
ReplaceMutationTest::testApplyInsertsNewRowWhenNoDuplicatecoversReplaceMutationTest::testApplyRemovesEveryRowConflictingWithAnyCandidateKeycoversReplaceMutationTest::testApplyReplacesExistingRowByPrimaryKeycoversReplaceMutationTest::testApplyReplacesMultipleRowscoversReplaceMutationTest::testApplyWithCompositePrimaryKeycoversReplaceMutationTest::testApplyWithMissingPrimaryKeyDoesNotMatchcoversReplaceMutationTest::testApplyWithoutCandidateKeysDoesNotReplaceEqualRowscoversReplaceMutationTest::testTableNameReturnsTableNamecovers
Calls 1
- static-call CandidateKeySet::fromSchema() line 34
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Test cases 7
ReplaceMutationTest::testApplyInsertsNewRowWhenNoDuplicatecovers and callsReplaceMutationTest::testApplyRemovesEveryRowConflictingWithAnyCandidateKeycovers and callsReplaceMutationTest::testApplyReplacesExistingRowByPrimaryKeycovers and callsReplaceMutationTest::testApplyReplacesMultipleRowscovers and callsReplaceMutationTest::testApplyWithCompositePrimaryKeycovers and callsReplaceMutationTest::testApplyWithMissingPrimaryKeyDoesNotMatchcovers and callsReplaceMutationTest::testApplyWithoutCandidateKeysDoesNotReplaceEqualRowscovers and calls
Calls 5
- method-call ShadowStore::get() line 42
- method-call CandidateKeySet::findConflict() line 45
- method-call ShadowStore::set() line 50
- function-call
array_valuesline 50 - method-call ShadowStore::insert() line 51
public function tableName(): string{@inheritDoc}
Returns
stringTest cases 1
ReplaceMutationTest::testTableNameReturnsTableNamecovers and calls
Private surface 2§
Implementation details, listed for orientation only.
private string $tableNameprivate CandidateKeySet $candidateKeysTest cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
ReplaceMutationTest::testApplyInsertsNewRowWhenNoDuplicatecovers and callsReplaceMutationTest::testApplyRemovesEveryRowConflictingWithAnyCandidateKeycovers and callsReplaceMutationTest::testApplyReplacesExistingRowByPrimaryKeycovers and callsReplaceMutationTest::testApplyReplacesMultipleRowscovers and callsReplaceMutationTest::testApplyWithCompositePrimaryKeycovers and callsReplaceMutationTest::testApplyWithMissingPrimaryKeyDoesNotMatchcovers and callsReplaceMutationTest::testApplyWithoutCandidateKeysDoesNotReplaceEqualRowscovers and callsReplaceMutationTest::testTableNameReturnsTableNamecovers and calls
Other tests reaching this symbol 2
Relations§
Constant reads 1
- class-const packages/ztd-query-core/src/Compatibility/ClassAliases.php packages/ztd-query-core/src/Compatibility/ClassAliases.php:23