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. |
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::testApplyInsertsNewRowWhenNoDuplicatecallsReplaceMutationTest::testApplyRemovesEveryRowConflictingWithAnyCandidateKeycallsReplaceMutationTest::testApplyReplacesExistingRowByPrimaryKeycallsReplaceMutationTest::testApplyReplacesMultipleRowscallsReplaceMutationTest::testApplyWithCompositePrimaryKeycallsReplaceMutationTest::testApplyWithMissingPrimaryKeyDoesNotMatchcallsReplaceMutationTest::testApplyWithoutCandidateKeysDoesNotReplaceEqualRowscalls
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(): stringPrivate surface 2§
Implementation details, listed for orientation only.
private string $tableNameprivate CandidateKeySet $candidateKeysTest cases 31§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
ReplaceMutationTest::testApplyInsertsNewRowWhenNoDuplicatecallsReplaceMutationTest::testApplyRemovesEveryRowConflictingWithAnyCandidateKeycallsReplaceMutationTest::testApplyReplacesExistingRowByPrimaryKeycallsReplaceMutationTest::testApplyReplacesMultipleRowscallsReplaceMutationTest::testApplyWithCompositePrimaryKeycallsReplaceMutationTest::testApplyWithMissingPrimaryKeyDoesNotMatchcallsReplaceMutationTest::testApplyWithoutCandidateKeysDoesNotReplaceEqualRowscallsReplaceMutationTest::testTableNameReturnsTableNamecalls
Other tests reaching this symbol 23
MySqlRewriterTest::testReplaceMutationInsertsNewRowcallsMySqlRewriterTest::testReplaceMutationReplacesExistingRowcallsMySqlRewriterTest::testRewriteReplaceCreatesMutationcallsMySqlRewriterTest::testRewriteReplaceWithColumnsDefinedcallsMySqlRewriterTest::testRewriteReplaceWithColumnsSucceedscallsMySqlRewriterTest::testRewriteReplaceWithoutColumnsButWithDefinitionSucceedscallsMySqlRewriterTest::testRewriteReplaceWithoutColumnsButWithShadowDataSucceedscallsSqliteRewriterTest::testInsertOrReplaceReturnsWriteSimulatedWithReplaceMutationcallsSqliteRewriterTest::testReplaceReturnsWriteSimulatedWithMutationcallsDataMutationTest::providerRowChangingMutationcallsMutationImpactTest::testReplaceIsInsertLikecallsRowMutationResolverTest::testResolveReplacecallsMySqlMutationResolverTest::testResolveReplaceReturnsPrimaryKeysFromRegistrycallsMySqlMutationResolverTest::testResolveReplaceReturnsReplaceMutationcallsMySqlMutationResolverTest::testResolveReplaceWithoutRegisteredSchemacallsInsertMutationResolverTest::testResolveInsertInsertIsReplaceReturnsPrimaryKeyscallsInsertMutationResolverTest::testResolveInsertInsertOrReplacecallsInsertMutationResolverTest::testResolveInsertReplacecallsInsertMutationResolverTest::testResolveInsertReplaceTableNamecallsSqliteMutationResolverTest::testResolveInsertIsReplaceReturnsPrimaryKeyscallsSqliteMutationResolverTest::testResolveInsertOrReplacecallsSqliteMutationResolverTest::testResolveReplacecallsSqliteMutationResolverTest::testResolveReplaceTableNamecalls
Relations§
Instantiated in 2
- new ZtdQuery\Platform\MySql\Shadow\Mutation\Row\RowMutationResolver::resolveReplace() packages/ztd-query-mysql/src/Shadow/Mutation/Row/RowMutationResolver.php:224
- new ZtdQuery\Platform\Sqlite\Shadow\Resolution\InsertMutationResolver::resolveInsert() packages/ztd-query-sqlite/src/Shadow/Resolution/InsertMutationResolver.php:48