classRowPairing
final class RowPairing
Which rows of a shadow before are which rows of the shadow after.
Pairing rows off is done in passes — the pairs an UPDATE tells us about first, then whatever the key can still match — and each pass has to know what the ones before it already took, or a row would be paired twice. Keeping the positions and the changes together is what makes that so.
Type Aliases§
Row = import from TableDefinitionMethods§
Pairs two rows off, and records the change where they differ.
Parameters
Test cases 3
Called from 3
- method-call ZtdQuery\Shadow\TableTransitions::pairIdentical() packages/ztd-query-core/src/Shadow/TableTransitions.php:126
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:168
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:195
public function beforePositions(): list<int>Answers the positions in the shadow before that were paired off.
Returns
list<int> The positionsTest cases 9
RowPairingTest::testBeforePositionsAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testPairRecordsBothPositionsAndTheChangeWhereTheRowsDiffercovers and callsRowPairingTest::testPairRecordsNoChangeWhereTheRowIsWhatItWascovers and callsTableTransitionsTest::testPairByIdentityLeavesARowNoResultRowSpeaksForcallsTableTransitionsTest::testPairByIdentityTakesThePairsAnUpdateToldUsAboutcallsTableTransitionsTest::testPairByKeyLeavesARowAlreadyPairedOffcallsTableTransitionsTest::testPairByKeyLeavesARowTheKeyNoLongerMatchescallsTableTransitionsTest::testPairByKeyPairsOffWhateverTheKeyStillMatchescallsTableTransitionsTest::testPairIdenticalPairsOffOnlyRowsThatAreWhatTheyWerecalls
Called from 3
- method-call ZtdQuery\Shadow\TableTransitions::between() packages/ztd-query-core/src/Shadow/TableTransitions.php:105
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:157
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:183
public function afterPositions(): list<int>Answers the positions in the shadow after that were paired off.
Returns
list<int> The positionsTest cases 5
RowPairingTest::testAfterPositionsAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testPairRecordsBothPositionsAndTheChangeWhereTheRowsDiffercovers and callsTableTransitionsTest::testPairByIdentityTakesThePairsAnUpdateToldUsAboutcallsTableTransitionsTest::testPairByKeyPairsOffWhateverTheKeyStillMatchescallsTableTransitionsTest::testPairIdenticalPairsOffOnlyRowsThatAreWhatTheyWerecalls
Called from 3
- method-call ZtdQuery\Shadow\TableTransitions::pairIdentical() packages/ztd-query-core/src/Shadow/TableTransitions.php:124
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:163
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:190
public function changes(): list<RowChange>Answers what happened to the rows that were paired off and differ.
Returns
list<RowChange> The changesTest cases 6
RowPairingTest::testChangesAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testPairRecordsBothPositionsAndTheChangeWhereTheRowsDiffercovers and callsRowPairingTest::testPairRecordsNoChangeWhereTheRowIsWhatItWascovers and callsTableTransitionsTest::testPairByIdentityTakesThePairsAnUpdateToldUsAboutcallsTableTransitionsTest::testPairByKeyPairsOffWhateverTheKeyStillMatchescallsTableTransitionsTest::testPairIdenticalPairsOffOnlyRowsThatAreWhatTheyWerecalls
Called from 1
Private surface 3§
Implementation details, listed for orientation only.
private list<int> $before = []private list<int> $after = []private list<RowChange> $changes = []Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
RowPairingTest::testAfterPositionsAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testBeforePositionsAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testChangesAnswersNothingWhereNothingWasPairedcovers and callsRowPairingTest::testPairRecordsBothPositionsAndTheChangeWhereTheRowsDiffercovers and callsRowPairingTest::testPairRecordsNoChangeWhereTheRowIsWhatItWascovers and calls
Other tests reaching this symbol 9
SessionTestcallsReferentialIntegrityEnforcerTestcallsShadowApplicationTestcallsTableTransitionsTest::testPairByIdentityLeavesARowNoResultRowSpeaksForcallsTableTransitionsTest::testPairByIdentityTakesThePairsAnUpdateToldUsAboutcallsTableTransitionsTest::testPairByKeyLeavesARowAlreadyPairedOffcallsTableTransitionsTest::testPairByKeyLeavesARowTheKeyNoLongerMatchescallsTableTransitionsTest::testPairByKeyPairsOffWhateverTheKeyStillMatchescallsTableTransitionsTest::testPairIdenticalPairsOffOnlyRowsThatAreWhatTheyWerecalls
Relations§
Instantiated in 1
Method calls 10
- method-call ZtdQuery\Shadow\TableTransitions::between() packages/ztd-query-core/src/Shadow/TableTransitions.php:105
- method-call ZtdQuery\Shadow\TableTransitions::between() packages/ztd-query-core/src/Shadow/TableTransitions.php:106
- method-call ZtdQuery\Shadow\TableTransitions::pairIdentical() packages/ztd-query-core/src/Shadow/TableTransitions.php:124
- method-call ZtdQuery\Shadow\TableTransitions::pairIdentical() packages/ztd-query-core/src/Shadow/TableTransitions.php:126
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:157
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:163
- method-call ZtdQuery\Shadow\TableTransitions::pairByIdentity() packages/ztd-query-core/src/Shadow/TableTransitions.php:168
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:183
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:190
- method-call ZtdQuery\Shadow\TableTransitions::pairByKey() packages/ztd-query-core/src/Shadow/TableTransitions.php:195