Repository navigation
feat: add the PSR-14 table gateway event dispatcher feature - #9
Merged
Merged
Conversation
Migrates the EventDispatcher feature from webinertia/phpdb-feature (0.1.x) into the PhpDb bridge, placed under the `PhpDb\` root this package shadows and named beside php-db's own laminas-based EventFeature: - `PhpDb\TableGateway\Feature\EventDispatcherFeature` implements php-db's EventFeatureEventsInterface and publishes each lifecycle hook through a PSR-14 dispatcher instead of a laminas event manager. - `PhpDb\TableGateway\Feature\EventDispatcher\TableGatewayEvent` is the event each hook is published as: the hook name, the table gateway as target, and the hook's arguments keyed as EventFeature keys them. `webware/webware-event` is require-dev plus a suggestion, not a runtime require: this package's own tests exercise the feature, and a consumer that uses it supplies its own event dispatcher. The lock moves to webware/webware-tools 1.0.0-rc.2 in the same update, which resets the tool pin this repo extends to Mago 1.54.0; the test files the formatter reshapes under that version are included. One analyzer baseline entry covers php-db's `AbstractFeature::$tableGateway`, which FeatureSet assigns after construction. Signed-off-by: Joey Smith <jsmith@webinertia.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Six topics under docs/v1: the shadow and what ships, installation, the schema factory, the session persistence and its table, the PSR-14 table gateway event feature, and development. Every statement was checked against the code, including the SchemaFactory exception paths and the backup prefix fallbacks, which were measured rather than inferred. Signed-off-by: Joey Smith <jsmith@webinertia.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The README now carries the quickstart: install, merge the providers, build an identifier from a schema enum, create the session table. It then links the six pages under docs/v1. The old Installation section claimed WebwareProvider must be registered after PhpDb\\ConfigProvider for its rules to win. The two share no config keys, so that ordering requirement was not real; the README now says so, and the ordering note it keeps is the one that does exist, SessionProvider after the Mezzio session providers. The seven em dashes in the README are replaced, matching the rule applied to docs/v1. Each quickstart step was executed before committing: the merged aggregator resolves SchemaFactory through the container, the enum yields 'acl_role' with no prefix configured and 'acl' as its schema, and SessionProvider registers both the SessionPersistenceInterface alias and the session:init-db command. Signed-off-by: Joey Smith <jsmith@webinertia.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The schema and event examples borrowed webware-acl's table name, and one borrowed webware-core's. Neither component is a collaborator of this bridge, so the examples now use the tables this package owns: WebwareSchema with a 'webware' schema and a 'session' case, and PhpDb\\Session\\SessionTable for the enum that leaves NAME at its default. The SchemaFactory docblock carried the same borrowed name and is updated with it. Every example was executed against the working tree before committing: with prefix 'ww' the enum yields 'ww_session' and schema 'webware'; per-table overrides yield 'sess_session' and 'tenant'; a call-time prefix yields 'x_session'; backup with 'bck' yields 'bck_session' and schema 'backup'; a backup with no backup_prefix yields 'session' with a null prefix; the shipped SessionTable yields a null schema; and an empty case value still raises Psl\\Type\\Exception\\AssertException. Signed-off-by: Joey Smith <jsmith@webinertia.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bles The fixtures carried webware-acl's and webware-core's names, neither of which is a collaborator of this bridge, and they were the source the docs had copied. They now use the table this package owns: - AclSchema, no NAME, becomes DefaultSchema with case Session = 'session'. - PublicSchema, which exercises the NAME constant, becomes WebwareSchema with NAME = 'webware', matching the example in docs/v1. - EmptySchema and IntSchema keep their purpose names and take case Session, so their values stay empty and int-backed. - The integration fixture becomes IntegrationSchema with case Session, and its DDL assertions move from ww_core_role to ww_session. SchemaFactoryTest and SchemaFactoryFactoryTest follow: per-table overrides are keyed 'session', and the NAME assertion now expects 'webware'. The schema fixture that leaves NAME alone produces a null schema, which is what the shipped PhpDb\\Session\\SessionTable does, so the pair now mirrors the package rather than an unrelated component. Verified locally: four Mago gates clean, unit suite OK (67 tests), integration suite OK (28 tests, 2 skipped for the disabled adapters), Infection Coverage 100% and Covered MSI 99% unchanged. The MySQL integration round-trip created and dropped ww_session, leaving the database empty. Signed-off-by: Joey Smith <jsmith@webinertia.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Migrates the EventDispatcher feature from
webinertia/phpdb-feature(0.1.x, thefinish-event-dispatcherline) into the PhpDb bridge.Where it lands
Under the
PhpDb\root this package shadows, named beside php-db's own laminas-basedEventFeature:webware/phpdb-featureWebware\PhpDb\Feature\EventDispatcherFeaturePhpDb\TableGateway\Feature\EventDispatcherFeatureWebware\PhpDb\Feature\EventDispatcher\TableGatewayEventPhpDb\TableGateway\Feature\EventDispatcher\TableGatewayEventEventDispatcherFeatureimplements php-db'sEventFeatureEventsInterface, so a table gateway accepts it exactly where php-db's feature is accepted, and publishes each lifecycle hook through a composed PSR-14 dispatcher rather than a laminas event manager.TableGatewayEventextendsWebware\Event\Event, carrying the hook name, the gateway as target, and the hook's arguments keyed asEventFeaturekeys them.The source branch's
RelatedTable\*group is not migrated: it importsPhpDb\RepositoryInterface, which php-db 0.6.x does not ship, and it stays inwebware/phpdb-featureuntouched.Dependencies
webware/webware-eventisrequire-devplus asuggest, not a runtime require — this package's own tests exercise the feature, and a consumer that uses it supplies its own dispatcher.The lock also moves to
webware/webware-tools1.0.0-rc.2, which resets the tool pin this repo extends to Mago 1.54.0. Supersedes #8, which bumped to the older1.0.0-beta.10. The six test files the formatter reshapes under that pin ((new X())()tonew X()()) are included.Verification, under the pinned Mago 1.54.0
format --checklint@mago-expect lint:too-many-methods, the hook set the interface fixes)analyzeAbstractFeature::$tableGateway, whichFeatureSet::setTableGateway()assigns after construction; the 9 pre-existing warnings/helps still report live and unchangedguardOK (95 tests, 196 assertions, 2 skipped)The single escaped mutant is in
SchemaFactory, pre-existing and untouched by this branch.