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. |
Test cases 9
UpdateMutationTest::testApplyLeavesATableTheOldKeyPointsAtNothingInAlonecoversUpdateMutationTest::testApplyWritesTheNewRowOverTheRowTheOldKeyPointsAtcoversUpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycoversUpdateMutationTest::testUpdateSameRowUniqueDoesNotThrowcoversUpdateMutationTest::testValidateNotNullThrowsExceptioncoversUpdateMutationTest::testValidateUniqueThrowsExceptioncoversUpdateMutationTest::testValidationDisabledByDefaultAllowsNullInNotNullColumncoversShadowMutationTest::testUpdateOnEmptyTablecoversShadowMutationTest::testUpdatePreservesRowCountcovers
Calls 1
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Test cases 13
MutationContractTest::testUpdateOnEmptyTablecallsMutationContractTest::testUpdatePreservesRowCountcallsUpdateMutationTest::testApplyLeavesATableTheOldKeyPointsAtNothingInAlonecovers and callsUpdateMutationTest::testApplyWritesTheNewRowOverTheRowTheOldKeyPointsAtcovers and callsUpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycovers and callsUpdateMutationTest::testUpdateSameRowUniqueDoesNotThrowcovers and callsUpdateMutationTest::testValidateNotNullThrowsExceptioncovers and callsUpdateMutationTest::testValidateUniqueThrowsExceptioncovers and callsUpdateMutationTest::testValidationDisabledByDefaultAllowsNullInNotNullColumncovers and callsShadowMutationTest::testUpdateOnEmptyTablecoversShadowMutationTest::testUpdatePreservesRowCountcoversReferentialIntegrityEnforcerTest::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
UpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycovers and calls
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 30§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
UpdateMutationTest::testApplyLeavesATableTheOldKeyPointsAtNothingInAlonecovers and callsUpdateMutationTest::testApplyWritesTheNewRowOverTheRowTheOldKeyPointsAtcovers and callsUpdateMutationTest::testTableNameApplyReplacesRowsByPrimaryKeycovers and callsUpdateMutationTest::testUpdateSameRowUniqueDoesNotThrowcovers and callsUpdateMutationTest::testValidateNotNullThrowsExceptioncovers and callsUpdateMutationTest::testValidateUniqueThrowsExceptioncovers and callsUpdateMutationTest::testValidationDisabledByDefaultAllowsNullInNotNullColumncovers and calls
Other tests reaching this symbol 23
MutationContractTest::testUpdateOnEmptyTablecallsMutationContractTest::testUpdatePreservesRowCountcallsRewriterContractTest::testUpdateReturnsWriteSimulatedWithMutationcallsFakeSqlRewriter::rewriteUpdatecallsSessionTest::testMutationFailureIsConvertedToDatabaseExceptioncallsDataMutationTest::providerRowChangingMutationcallsMutationImpactTest::testNoneModeHidesInternalMigrationRowscallsMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecallsMutationImpactTest::testReturningRowsPreserveSparseInputKeyscallsMutationImpactTest::testReturningUpdateRowsExcludeInternalIdentityMetadatacallsMutationImpactTest::testRowsWithDifferentColumnsOrValuesAreChangedcallsShadowMutationTest::testUpdateOnEmptyTablecoversShadowMutationTest::testUpdatePreservesRowCountcoversReferentialIntegrityEnforcerTest::testCascadeNormalizesSparseChildRowIndexescallsReferentialIntegrityEnforcerTest::testCompositePrimaryKeyUpdateCascadesOnlyMatchingChildrencallsReferentialIntegrityEnforcerTest::testFallbackContinuesAfterIdentityMatchedRowcallsReferentialIntegrityEnforcerTest::testFallbackReferencedPrimaryKeyAppearsInUpdateViolationcallsReferentialIntegrityEnforcerTest::testIdentityTransitionSkipsIncompleteChangeAndProcessesFollowingChangecallsReferentialIntegrityEnforcerTest::testPrimaryKeyUpdateCascadesThroughOriginalRowIdentitycallsReferentialIntegrityEnforcerTest::testRetainedOldKeyDoesNotStopFollowingUpdateCascadecallsReferentialIntegrityEnforcerTest::testUpdateCascadeCarriesOriginalRowIntoNextLevelcallsReferentialIntegrityEnforcerTest::testUpdateDoesNotCascadeWhileOldParentKeyStillExistscallsTableTransitionsTest::testOfReadsTheResultRowsOnlyForTheTableAnUpdateNamescalls
Relations§
Constant reads 1
- class-const packages/ztd-query-core/src/Compatibility/ClassAliases.php packages/ztd-query-core/src/Compatibility/ClassAliases.php:18
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