classUpdateMutation
final class UpdateMutation
implements DataMutation
Applies UPDATE result rows to the shadow store.
Type Aliases§
Row = import from TableDefinitionMethods§
public function __construct(
string $tableName,
list<string> $primaryKeys,
TableDefinition|null $tableDefinition = null,
string $sql = '',
bool $validateConstraints = false,
)Parameters
$tableName | string | Target table. |
$primaryKeys | list<string> | Primary key columns. |
$tableDefinition | TableDefinition|null | Table definition for constraint validation. |
$sql | string | Original SQL statement for exception messages. |
$validateConstraints | bool | Whether to validate constraints. |
Calls 1
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Test cases 11
MutationContractTest::testUpdateOnEmptyTablecallsMutationContractTest::testUpdatePreservesRowCountcallsUpdateMutationTest::testApplyLeavesATableTheOldKeyPointsAtNothingInAlonecallsUpdateMutationTest::testApplyWritesTheNewRowOverTheRowTheOldKeyPointsAtcallsUpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycallsUpdateMutationTest::testUpdateSameRowUniqueDoesNotThrowcallsUpdateMutationTest::testValidateNotNullThrowsExceptioncallsUpdateMutationTest::testValidateUniqueThrowsExceptioncallsUpdateMutationTest::testValidationDisabledByDefaultAllowsNullInNotNullColumncallsReferentialIntegrityEnforcerTest::testCompositePrimaryKeyUpdateCascadesOnlyMatchingChildrencallsReferentialIntegrityEnforcerTest::testPrimaryKeyUpdateCascadesThroughOriginalRowIdentitycalls
Calls 7
- new MutationRowIdentity line 84
- method-call MutationRowIdentity::extract() line 87
- function-call
array_columnline 89 - method-call ShadowStore::get() line 92
- method-call RowConstraints::assertNoNullWhereNoneIsAllowed() line 95
- method-call RowConstraints::assertNoDuplicateUniqueKey() line 96
- method-call ShadowStore::updateIdentified() line 100
public function tableName(): string{@inheritDoc}
Returns
stringTest cases 1
Private surface 6§
Implementation details, listed for orientation only.
private string $tableNameprivate list<string> $primaryKeysprivate TableDefinition|null $tableDefinitionprivate string $sqlprivate bool $validateConstraintsprivate RowConstraints $constraintsTest cases 63§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
UpdateMutationTest::testApplyLeavesATableTheOldKeyPointsAtNothingInAlonecallsUpdateMutationTest::testApplyWritesTheNewRowOverTheRowTheOldKeyPointsAtcallsUpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycallsUpdateMutationTest::testUpdateSameRowUniqueDoesNotThrowcallsUpdateMutationTest::testValidateNotNullThrowsExceptioncallsUpdateMutationTest::testValidateUniqueThrowsExceptioncallsUpdateMutationTest::testValidationDisabledByDefaultAllowsNullInNotNullColumncalls
Other tests reaching this symbol 56
MutationContractTest::testUpdateOnEmptyTablecallsMutationContractTest::testUpdatePreservesRowCountcallsRewriterContractTest::testUpdateReturnsWriteSimulatedWithMutationcallsFakeSqlRewriter::rewriteUpdatecallsMySqlRewriterTest::testRewriteUpdateCreatesMutationcallsMySqlRewriterTest::testUpdateReturnsWriteSimulatedWithMutationcallsPgSqlRewriterTest::testRewriteUpdateReturnsWriteSimulatedcallsPgSqlRewriterTest::testUpdateMutationTableNamecallsPgSqlRewriterTest::testUpdateResolvesTargetAfterBlockCommentcallsPgSqlRewriterTest::testUpdateReturnsWriteSimulatedWithMutationcallsSqliteRewriterTest::testUpdateResolvesTargetAfterBlockCommentcallsSqliteRewriterTest::testUpdateReturnsWriteSimulatedWithMutationcallsSessionTest::testMutationFailureIsConvertedToDatabaseExceptioncallsDataMutationTest::providerRowChangingMutationcallsMutationImpactTest::testNoneModeHidesInternalMigrationRowscallsMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecallsMutationImpactTest::testReturningRowsPreserveSparseInputKeyscallsMutationImpactTest::testReturningUpdateRowsExcludeInternalIdentityMetadatacallsMutationImpactTest::testRowsWithDifferentColumnsOrValuesAreChangedcallsRowMutationResolverTest::testResolveUpdatecallsShadowMutationTestcallsMySqlMutationResolverTest::testResolveUpdateMultiTableReturnsPrimaryKeysFromDefinitioncallsMySqlMutationResolverTest::testResolveUpdateReturnsUpdateMutationcallsMySqlMutationResolverTest::testResolveUpdateUsesColumnsFromRegistryWhenStoreEmptycallsMySqlMutationResolverTest::testResolveUpdateUsesColumnsFromShadowStoreFirstcallsMySqlMutationResolverTest::testResolveUpdateWithShadowDataButNoDefinitioncallsMySqlMutationResolverTest::testUpdateUsesColumnsFromStoreWhenAvailablecallsPgSqlMutationResolverTest::testResolveUpdateLowercaseExtractsTablecallsPgSqlMutationResolverTest::testResolveUpdateReturnsPrimaryKeysFromRegistrycallsPgSqlMutationResolverTest::testResolveUpdateReturnsUpdateMutationcallsPgSqlMutationResolverTest::testResolveUpdateWithoutRegistryReturnsEmptyPrimaryKeyscallsPgSqlMutationResolverTest::testResolveUpdateWithRegisteredTablecallsReferentialIntegrityEnforcerTest::testCascadeNormalizesSparseChildRowIndexescallsReferentialIntegrityEnforcerTest::testCompositePrimaryKeyUpdateCascadesOnlyMatchingChildrencallsReferentialIntegrityEnforcerTest::testFallbackContinuesAfterIdentityMatchedRowcallsReferentialIntegrityEnforcerTest::testFallbackReferencedPrimaryKeyAppearsInUpdateViolationcallsReferentialIntegrityEnforcerTest::testIdentityTransitionSkipsIncompleteChangeAndProcessesFollowingChangecallsReferentialIntegrityEnforcerTest::testPrimaryKeyUpdateCascadesThroughOriginalRowIdentitycallsReferentialIntegrityEnforcerTest::testRetainedOldKeyDoesNotStopFollowingUpdateCascadecallsReferentialIntegrityEnforcerTest::testUpdateCascadeCarriesOriginalRowIntoNextLevelcallsReferentialIntegrityEnforcerTest::testUpdateDoesNotCascadeWhileOldParentKeyStillExistscallsRowMutationResolverTest::testResolveUpdatecallsRowMutationResolverTest::testResolveUpdateEnsuresShadowStoreWithDefinitioncallsRowMutationResolverTest::testResolveUpdatePrimaryKeysFromDefinitioncallsRowMutationResolverTest::testResolveUpdateWithDefinitionReturnsPrimaryKeyscallsRowMutationResolverTest::testResolveUpdateWithoutDefinitionHasEmptyPrimaryKeyscallsRowMutationResolverTest::testResolveUpdateWithoutDefinitionReturnsEmptyPrimaryKeyscallsRowMutationResolverTest::testResolveUpdateWithPrimaryKeyscallsSqliteMutationResolverTest::testResolveUpdatecallsSqliteMutationResolverTest::testResolveUpdateEnsuresShadowStoreWithDefinitioncallsSqliteMutationResolverTest::testResolveUpdatePrimaryKeysFromDefinitioncallsSqliteMutationResolverTest::testResolveUpdateWithDefinitionReturnsPrimaryKeyscallsSqliteMutationResolverTest::testResolveUpdateWithoutDefinitionHasEmptyPrimaryKeyscallsSqliteMutationResolverTest::testResolveUpdateWithoutDefinitionReturnsEmptyPrimaryKeyscallsSqliteMutationResolverTest::testResolveUpdateWithPrimaryKeyscallsTableTransitionsTest::testOfReadsTheResultRowsOnlyForTheTableAnUpdateNamescalls
Relations§
Instantiated in 3
- new ZtdQuery\Platform\MySql\Shadow\Mutation\Row\RowMutationResolver::resolveUpdate() packages/ztd-query-mysql/src/Shadow/Mutation/Row/RowMutationResolver.php:84
- new ZtdQuery\Platform\Postgres\Shadow\Mutation\Row\RowMutationResolver::resolveUpdate() packages/ztd-query-postgres/src/Shadow/Mutation/Row/RowMutationResolver.php:121
- new ZtdQuery\Platform\Sqlite\Shadow\Resolution\RowMutationResolver::resolveUpdate() packages/ztd-query-sqlite/src/Shadow/Resolution/RowMutationResolver.php:55
Type checks 3
- instanceof ZtdQuery\Shadow\Mutation\MutationImpact::affectedRowCount() packages/ztd-query-core/src/Shadow/Mutation/MutationImpact.php:63
- instanceof ZtdQuery\Shadow\Mutation\MutationImpact::returningRows() packages/ztd-query-core/src/Shadow/Mutation/MutationImpact.php:84
- instanceof ZtdQuery\Shadow\TableTransitions::of() packages/ztd-query-core/src/Shadow/TableTransitions.php:58