classForeignKeyDefinition
final class ForeignKeyDefinition
One foreign key: which columns point where, and what happens when the parent moves.
Properties§
public non-empty-list<string> $columnspublic string $referencedTablepublic list<string> $referencedColumnspublic ReferentialAction $onDelete = ReferentialAction::NoActionpublic ReferentialAction $onUpdate = ReferentialAction::NoActionMethods§
public function __construct(
public non-empty-list<string> $columns,
public string $referencedTable,
public list<string> $referencedColumns,
public ReferentialAction $onDelete = ReferentialAction::NoAction,
public ReferentialAction $onUpdate = ReferentialAction::NoAction,
)Parameters
$columns | non-empty-list<string> | |
$referencedTable | string | |
$referencedColumns | list<string> | |
$onDelete | ReferentialAction | |
$onUpdate | ReferentialAction |
Test cases 1
Calls 1
- class-const ReferentialAction::NoAction() line 20
Test cases 54§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ForeignKeyDefinitionTest::testCarriesCompositeReferenceAndActionscovers and calls
Other tests reaching this symbol 53
CascadingShop::registrycallsTableDefinitionTest::testKeepsEverythingATableDeclaresAboutItselfcallsSessionTest::testForeignKeyFailureRestoresShadowStatecallsFollowedConstraintTest::testCarriesWhatIsNeededToFollowAKeyAndToRefuseItcallsForeignKeyCascadeTest::testApplyActionCarriesTheNewValueWhereTheActionSaysToCascadecallsForeignKeyCascadeTest::testApplyActionRefusesTheStatementWhereTheActionForbidsItcallsForeignKeyCascadeTest::testApplyActionSetsTheKeyToNullWhereTheActionSaysTocallsForeignKeyCascadeTest::testCarryDeleteDropsEveryChildThatWasHoldingTheKeyWhereTheActionCascadescallsForeignKeyCascadeTest::testCarryDeleteReachesNothingWhereTheParentTableStillHoldsTheKeycallsForeignKeyCascadeTest::testCarryDeleteSetsTheKeyToNullWhereTheActionSaysToRatherThanDroppingTheRowcallsForeignKeyCascadeTest::testCarryUpdateReachesNothingWhereTheParentTableStillHoldsTheOldKeycallsForeignKeyCascadeTest::testCarryUpdateWritesTheNewKeyIntoEveryChildThatWasHoldingTheOldOnecallsForeignKeyCascadeTest::testOfCarriesTheNewKeyToTheChildrenOfAnUpdatedParentcallsForeignKeyCascadeTest::testOfDeletesTheChildrenOfADeletedParentWhereTheActionSaysToCascadecallsForeignKeyCascadeTest::testOfFollowsNothingThroughAKeyWhoseEndsDisagreecallsForeignKeyCascadeTest::testOfLeavesTheChildrenAloneWhileAnotherParentRowHoldsTheKeyUpcallsForeignKeyEndsTest::testAreBalancedIsFalseWhereTheEndsDisagreecallsForeignKeyEndsTest::testAreBalancedWhenBothEndsNameTheSameNumberOfColumnscallsForeignKeyEndsTest::testReferencedColumnsAnswersTheColumnsTheKeyNamescallsForeignKeyEndsTest::testReferencedColumnsFallsBackToTheParentsPrimaryKeycallsForeignKeyEndsTest::testReferencedColumnsIsEmptyWhereTheParentIsUnknowncallsForeignKeyIntegrityTest::testAssertHoldsChecksNothingThroughAKeyWhoseEndsDisagreecallsForeignKeyIntegrityTest::testAssertHoldsLeavesAKeyWithANullInItAlonecallsForeignKeyIntegrityTest::testAssertHoldsLeavesARowThatDoesNotCarryTheKeyColumnsAlonecallsForeignKeyIntegrityTest::testAssertHoldsPassesAShadowInWhichEveryChildFindsItsParentcallsForeignKeyIntegrityTest::testAssertHoldsRefusesAShadowInWhichAChildReferencesNothingcallsReferentialIntegrityEnforcerTest::testAcceptsExplicitReferenceToNonPrimaryCandidateKeycallsReferentialIntegrityEnforcerTest::testCascadeNormalizesSparseChildRowIndexescallsReferentialIntegrityEnforcerTest::testCompositeDeleteSetNullNormalizesEveryForeignKeyColumncallsReferentialIntegrityEnforcerTest::testCompositePrimaryKeyUpdateCascadesOnlyMatchingChildrencallsReferentialIntegrityEnforcerTest::testDeleteCascadePropagatesAcrossMultipleLevelscallsReferentialIntegrityEnforcerTest::testDeleteCascadeRemovesAllMatchingChildrenAndKeepsOtherscallsReferentialIntegrityEnforcerTest::testDeleteRestrictRejectsParentRemovalcallsReferentialIntegrityEnforcerTest::testDeleteSetNullCarriesOriginalRowIntoNextLevelcallsReferentialIntegrityEnforcerTest::testDeleteSetNullUpdatesChildcallsReferentialIntegrityEnforcerTest::testEmptySelfReferentialCascadeTerminatesWithoutSyntheticEventscallsReferentialIntegrityEnforcerTest::testExplicitReferencedColumnsAreNotReplacedByPrimaryKeycallsReferentialIntegrityEnforcerTest::testFallbackContinuesAfterIdentityMatchedRowcallsReferentialIntegrityEnforcerTest::testFallbackReferencedPrimaryKeyAppearsInUpdateViolationcallsReferentialIntegrityEnforcerTest::testFallbackTransitionPropagatesUpdateAndDeleteFromOneTablecallsReferentialIntegrityEnforcerTest::testIdentityTransitionSkipsIncompleteChangeAndProcessesFollowingChangecallsReferentialIntegrityEnforcerTest::testMatchingConstraintAfterUnrelatedConstraintStillCascadescallsReferentialIntegrityEnforcerTest::testMissingReferencedValuesDoNotStopLaterUpdateOrDeleteCascadescallsReferentialIntegrityEnforcerTest::testMultiTruncateCascadesFromEveryChangedParentTablecallsReferentialIntegrityEnforcerTest::testPrimaryKeyUpdateCascadesThroughOriginalRowIdentitycallsReferentialIntegrityEnforcerTest::testRejectsInsertWhoseParentDoesNotExistcallsReferentialIntegrityEnforcerTest::testRetainedOldKeyDoesNotStopFollowingUpdateCascadecallsReferentialIntegrityEnforcerTest::testSchemaMutationDoesNotTriggerRowValidationcallsReferentialIntegrityEnforcerTest::testSchemaMutationSkipsRowIntegrityCheckscallsReferentialIntegrityEnforcerTest::testSynchronizeCascadesDeletedRowscallsReferentialIntegrityEnforcerTest::testUpdateCascadeCarriesOriginalRowIntoNextLevelcallsReferentialIntegrityEnforcerTest::testUpdateDoesNotCascadeWhileOldParentKeyStillExistscallsReferentialIntegrityEnforcerTest::testValidationContinuesPastMissingAndNullForeignKeyscalls
Relations§
Constant reads 1
- class-const packages/ztd-query-core/src/Compatibility/ClassAliases.php packages/ztd-query-core/src/Compatibility/ClassAliases.php:38
Type declarations 4
- type ZtdQuery\Shadow\FollowedConstraint packages/ztd-query-core/src/Shadow/FollowedConstraint.php:28
- type ZtdQuery\Shadow\ForeignKeyCascade packages/ztd-query-core/src/Shadow/ForeignKeyCascade.php:63
- type ZtdQuery\Shadow\ForeignKeyEnds packages/ztd-query-core/src/Shadow/ForeignKeyEnds.php:33
- type ZtdQuery\Shadow\ForeignKeyEnds packages/ztd-query-core/src/Shadow/ForeignKeyEnds.php:57