Conversation
This commit refactors the application from a Service Layer pattern to Command Query Responsibility Segregation (CQRS), separating write operations (Commands) from read operations (Queries). - **Symfony Messenger:** Configured distinct `command.bus` and `query.bus` to handle the different message types. - **Commands & Queries:** Introduced immutable Command and Query objects to represent specific user intents (e.g., `CreateNoteCommand`, `ListNotesQuery`). - **Handlers:** The `NoteService` has been removed, and its logic (including event dispatching and logging) is now encapsulated in dedicated, single-responsibility `CommandHandler` and `QueryHandler` classes. - **Controllers:** All controllers have been updated to dispatch Commands or ask Queries via the new buses, removing their direct dependency on the `NoteService`. This new architecture establishes a clearer separation of concerns and makes each component's responsibility more explicit. Signed-off-by: azjezz <azjezz@protonmail.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.
This commit refactors the application from a Service Layer pattern to Command Query Responsibility Segregation (CQRS), separating write operations (Commands) from read operations (Queries).
command.busandquery.busto handle the different message types.CreateNoteCommand,ListNotesQuery).NoteServicehas been removed, and its logic (including event dispatching and logging) is now encapsulated in dedicated, single-responsibilityCommandHandlerandQueryHandlerclasses.NoteService.This new architecture establishes a clearer separation of concerns and makes each component's responsibility more explicit.