Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ed02b5a
Bring TableGateway and RowGateway to Mago compliance
simon-mundy Oct 11, 2026
b2bb593
Merge remote-tracking branch 'fork/qa/mago-sql-dml' into qa/mago-gate…
simon-mundy Oct 12, 2026
95c4b0e
Merge branch '0.6.x' into qa/mago-gateways
simon-mundy Oct 12, 2026
80da8c0
Merge remote-tracking branch 'fork/qa/mago-sql-dml' into qa/mago-gate…
simon-mundy Oct 12, 2026
7b82845
Merge remote-tracking branch 'fork/qa/mago-sql-dml' into qa/mago-gate…
simon-mundy Oct 12, 2026
3b42542
Merge remote-tracking branch 'fork/qa/mago-sql-dml' into qa/mago-gate…
simon-mundy Oct 12, 2026
02d88ed
Merge remote-tracking branch 'fork/qa/mago-sql-dml' into qa/mago-gate…
simon-mundy Oct 12, 2026
46b079a
Merge branch '0.6.x' into qa/mago-gateways
simon-mundy Oct 12, 2026
e9d25c0
Reinstate RowGateway FeatureSet's $magicSpecifications and tag it @api
simon-mundy Oct 12, 2026
b233546
Stop swapping aliased tables during gateway execution
simon-mundy Oct 12, 2026
36a8cee
Define the gateway table and where types on TableGatewayInterface
simon-mundy Oct 12, 2026
c200dce
Drop the coverage target for the removed AbstractTableGateway::unalia…
simon-mundy Oct 12, 2026
f2af463
Cover the abstract gateways by class rather than by method
simon-mundy Oct 12, 2026
608d9bb
Create gateway feature sets only when features are configured
simon-mundy Nov 4, 2026
3f363e3
Merge branch '0.6.x' into qa/mago-gateways
simon-mundy Nov 4, 2026
4eeae50
Clear the gateway test lint baseline entries
simon-mundy Nov 4, 2026
4bb3a79
Keep the table reference when cloning a table gateway
simon-mundy Nov 4, 2026
a478946
Test saving a composite-key row that is missing a key column
simon-mundy Nov 4, 2026
01f7686
Merge branch '0.6.x' into qa/mago-gateways
simon-mundy Nov 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
648 changes: 3 additions & 645 deletions analyzer-baseline.toml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/book/table-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ constructor. The constructor can take features in 3 different forms:
- as a `FeatureSet` instance
- as an array of `Feature` instances

A gateway given no features does not create a `FeatureSet`, so its operations
skip feature dispatch entirely. `getFeatureSet()` creates an empty one, bound
to the gateway, the first time it is called; a feature added to it then works
like any other, except that it does not receive the initialization events,
which have already run. In a subclass, `$this->featureSet` is `null` until a
feature set is configured, so read it with `?->` or call `getFeatureSet()`.

There are a number of features built-in and shipped with laminas-db:

### GlobalAdapterFeature
Expand Down
120 changes: 3 additions & 117 deletions lint-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,6 @@ code = "cyclomatic-complexity"
message = "Class has high complexity."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "halstead"
message = "Method has a high halstead difficulty"
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "kan-defect"
Expand All @@ -264,60 +258,6 @@ code = "no-boolean-flag-parameter"
message = "Avoid boolean flag parameters."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "no-dead-store"
message = "Variable `$rowsAffected` is overwritten before its value is read."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "no-else-clause"
message = "Avoid `else` clauses."
count = 4

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "no-isset"
message = "Use of the `isset` construct."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "prefer-early-continue"
message = "Consider using early continue pattern to reduce nesting."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "too-many-methods"
message = "Class has too many methods."
count = 1

[[issues]]
file = "src/RowGateway/AbstractRowGateway.php"
code = "yoda-conditions"
message = "Use Yoda condition style for safer comparisons"
count = 6

[[issues]]
file = "src/RowGateway/Feature/FeatureSet.php"
code = "too-many-methods"
message = "Class has too many methods."
count = 1

[[issues]]
file = "src/RowGateway/RowGateway.php"
code = "no-else-clause"
message = "Avoid `else` clauses."
count = 1

[[issues]]
file = "src/RowGateway/RowGateway.php"
code = "no-negated-ternary"
message = "Negated ternary condition."
count = 1

[[issues]]
file = "src/Sql/AbstractSql.php"
code = "cyclomatic-complexity"
Expand Down Expand Up @@ -384,64 +324,22 @@ code = "cyclomatic-complexity"
message = "Class has high complexity."
count = 1

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "halstead"
message = "Method has a high halstead difficulty"
count = 1

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "kan-defect"
message = "Class has a high kan defect score."
count = 1

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "no-else-clause"
message = "Avoid `else` clauses."
count = 1

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "no-else-clause"
message = "Avoid `elseif` clauses."
count = 2

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "no-isset"
message = "Use of the `isset` construct."
count = 3

[[issues]]
file = "src/TableGateway/AbstractTableGateway.php"
code = "too-many-methods"
message = "Class has too many methods."
count = 1

[[issues]]
file = "src/TableGateway/Feature/EventFeature.php"
code = "too-many-methods"
message = "Class has too many methods."
count = 1

[[issues]]
file = "src/TableGateway/Feature/FeatureSet.php"
code = "kan-defect"
message = "Class has a high kan defect score."
count = 1

[[issues]]
file = "src/TableGateway/Feature/FeatureSet.php"
code = "too-many-methods"
message = "Class has too many methods."
count = 1

[[issues]]
file = "src/TableGateway/TableGateway.php"
code = "no-shorthand-ternary"
message = "Use of the shorthand ternary operator."
file = "src/TableGateway/Feature/RowGatewayFeature.php"
code = "cyclomatic-complexity"
message = "Class has high complexity."
count = 1

[[issues]]
Expand Down Expand Up @@ -570,12 +468,6 @@ code = "literal-named-argument"
message = "Literal argument `true` should be passed as a named argument for clarity."
count = 1

[[issues]]
file = "test/unit/RowGateway/AbstractRowGatewayTest.php"
code = "no-isset"
message = "Use of the `isset` construct."
count = 4

[[issues]]
file = "test/unit/Sql/AbstractSqlFunctionalTestCase.php"
code = "halstead"
Expand Down Expand Up @@ -791,9 +683,3 @@ file = "test/unit/Sql/UpdateTest.php"
code = "no-fully-qualified-global-class-like"
message = "Fully-qualified class-like reference detected."
count = 1

[[issues]]
file = "test/unit/TableGateway/TableGatewayTest.php"
code = "no-assign-in-argument"
message = "Avoid assignments in function call arguments."
count = 3
9 changes: 9 additions & 0 deletions mago.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ baseline = "lint-baseline.toml"
# not apply. Predicate, AlterTable, CreateTable, Select, Insert and Update are fluent builders:
# one public method per clause they can emit, so their method count is the size of their
# public API. AbstractSql is their base and carries one protected hook per clause it renders.
# AbstractTableGateway and AbstractRowGateway expose one public method per gateway operation
# plus the ArrayAccess and magic-property contracts, the two FeatureSets one method per hook
# and magic dispatch they forward to features, and EventFeature one listener per gateway event,
# so their method count is the size of their public API as well.
# "test/" repeats the phpdb-qa-tools default, which this key replaces.
too-many-methods = { exclude = [
"test/",
Expand All @@ -32,6 +36,11 @@ too-many-methods = { exclude = [
"src/Sql/Select.php",
"src/Sql/Insert.php",
"src/Sql/Update.php",
"src/TableGateway/AbstractTableGateway.php",
"src/TableGateway/Feature/EventFeature.php",
"src/TableGateway/Feature/FeatureSet.php",
"src/RowGateway/AbstractRowGateway.php",
"src/RowGateway/Feature/FeatureSet.php",
] }

# Select holds one property per clause of a SELECT statement.
Expand Down
3 changes: 3 additions & 0 deletions src/Adapter/Driver/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use PhpDb\Adapter\Exception;
use PhpDb\ResultSet\ResultSetInterface;

/**
* @extends Iterator<array-key, mixed>
*/
interface ResultInterface extends Countable, Iterator
{
/**
Expand Down
Loading
Loading