Skip to content

Document handler attribute validation, transactional handlers and registry reset - #11

Merged
papac merged 2 commits into
mainfrom
chore/package
Oct 4, 2026
Merged

papac merged 2 commits into
mainfrom
chore/package

Conversation

@papac

@papac papac commented Oct 4, 2026

Copy link
Copy Markdown
Member

Summary

Readme-only change. Documents three behaviours of the CQRS package that were implemented but not described anywhere:

  • Handler attribute validation. A class passed to CQRSRegistration::handlers() must carry at least one #[CommandHandler] or #[QueryHandler] attribute, otherwise CQRSException is thrown at registration time rather than at dispatch.
  • Transactional command handlers. Extend CommandHandlerTransactionService and implement run() instead of process(). The base class wraps the call in Database::startTransaction() / commit() / rollback(), so any exception thrown inside run() rolls the transaction back. Includes a CreateUserCommandHandler example.
  • Resetting the registry in tests. Registration holds commands and queries in static state. CQRSRegistration::reset() clears it between test cases, with a setUp() example.

The new material sits right after the existing CQRSRegistration::handlers([...]) example and before the controller usage section.

Verification

Documentation only, no code changes.

@papac
papac merged commit 174ea4f into main Oct 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant