Repository navigation
Add PrimaryReplicaFeature; deprecate MasterSlaveFeature - #187
Merged
simon-mundy merged 3 commits intoSep 28, 2026
Merged
Conversation
Introduces PrimaryReplicaFeature with the neutral primary/replica terminology, carrying the full behaviour of MasterSlaveFeature including the nullable Sql state and the postInitialize()/postSelect() guard clauses. MasterSlaveFeature now extends PrimaryReplicaFeature and is marked @deprecated. Its constructor keeps the original parameter names so named arguments continue to work, and getSlaveAdapter()/getSlaveSql() proxy to getReplicaAdapter()/getReplicaSql(). It is slated for removal in the next major release. Note that the RuntimeException message raised by postSelect() now refers to the "primary" Sql instance rather than the "master" one. Closes php-db#111
simon-mundy
force-pushed
the
feature/111-primary-replica-feature
branch
from
September 28, 2026 01:13
a072b78 to
1830c9f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The Mago QA job fails on 0.6.x independently of any feature work: the pinned toolchain is now mago 1.50.0, whose analyzer emits codes and inferred types that the committed baselines predate, and two multi-line conditions in AbstractTableGateway drifted from the formatter. Reformats those conditions and regenerates both baselines so format, lint and analyze pass again. The regenerated analyzer baseline absorbs 15 genuine type-precision complaints in Profiler, PredicateSet, AbstractSql and CreateTable. They are suppressed here only to restore a green build; each still warrants fixing on its own merit.
tyrsson
approved these changes
Sep 28, 2026
This was referenced Sep 28, 2026
simon-mundy
added a commit
to simon-mundy/phpdb
that referenced
this pull request
Sep 28, 2026
…ructors All 36 throw sites in src/TableGateway and src/RowGateway now call a named constructor. Message text is byte-identical apart from the magic-access messages noted below, verified template by template against the originals. - Add 19 templates and factories to TableGateway\Exception\RuntimeException, 4 to its InvalidArgumentException, 5 to RowGateway\Exception\RuntimeException and 2 to its InvalidArgumentException - Cover PrimaryReplicaFeature, added by php-db#187. Its first guard reuses MISSING_SQL_INSTANCE; its second reports the primary rather than the master, so MISSING_MASTER_SQL becomes MISSING_PRIMARY_SQL. MasterSlaveFeature no longer throws, since php-db#187 left it delegating to the replacement - Collapse the four "table name of the provided X object" copies onto one template taking the statement name - Report the concrete class in the magic access messages: AbstractTableGateway interpolated self::class, so a TableGateway named its abstract parent. The three messages now carry static::class - Point SequenceFeature at TableGateway\Exception\RuntimeException; it was throwing the root PhpDb\Exception\RuntimeException from inside the component - Rename the test__* methods to testMagicGet, testMagicSet and testMagicCall forms and drop the codingStandardsIgnore pairs they needed - Cover every factory with a template test, and derive the message assertions from the templates rather than restating them - Re-attribute the baselined mixed-operand concatenation entry in AbstractRowGateway to the factory that now receives the argument, exclude src/TableGateway/Exception/ from too-many-methods, and baseline the halstead reading AbstractTableGateway shifts Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
simon-mundy
added a commit
to simon-mundy/phpdb
that referenced
this pull request
Sep 29, 2026
…ructors All 36 throw sites in src/TableGateway and src/RowGateway now call a named constructor. Message text is byte-identical apart from the magic-access messages noted below, verified template by template against the originals. - Add 19 templates and factories to TableGateway\Exception\RuntimeException, 4 to its InvalidArgumentException, 5 to RowGateway\Exception\RuntimeException and 2 to its InvalidArgumentException - Cover PrimaryReplicaFeature, added by php-db#187. Its first guard reuses MISSING_SQL_INSTANCE; its second reports the primary rather than the master, so MISSING_MASTER_SQL becomes MISSING_PRIMARY_SQL. MasterSlaveFeature no longer throws, since php-db#187 left it delegating to the replacement - Collapse the four "table name of the provided X object" copies onto one template taking the statement name - Report the concrete class in the magic access messages: AbstractTableGateway interpolated self::class, so a TableGateway named its abstract parent. The three messages now carry static::class - Point SequenceFeature at TableGateway\Exception\RuntimeException; it was throwing the root PhpDb\Exception\RuntimeException from inside the component - Rename the test__* methods to testMagicGet, testMagicSet and testMagicCall forms and drop the codingStandardsIgnore pairs they needed - Cover every factory with a template test, and derive the message assertions from the templates rather than restating them - Re-attribute the baselined mixed-operand concatenation entry in AbstractRowGateway to the factory that now receives the argument, exclude src/TableGateway/Exception/ from too-many-methods, and baseline the halstead reading AbstractTableGateway shifts Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces PrimaryReplicaFeature with the neutral primary/replica terminology, carrying the full behaviour previously implemented by MasterSlaveFeature.
MasterSlaveFeature now extends PrimaryReplicaFeature and is marked @deprecated. Its constructor keeps the original parameter names so named arguments continue to work, and getSlaveAdapter()/getSlaveSql() proxy to getReplicaAdapter()/getReplicaSql(). It is slated for removal in the next major release.
Regenerates the mago lint and analyzer baselines.
Closes #111
Types of changes
Checklist: