Merged
Conversation
added 15 commits
March 5, 2026 10:23
Reviewer's GuideReplaces the legacy SimpleBus command bus integration with Symfony Messenger for command handling across multiple backend and frontend modules, updates handlers to be Messenger message handlers with explicit flushing, simplifies service wiring via autowiring/autoconfigure, and removes SimpleBus-related bundles and dependencies. Sequence diagram for creating a content block via Symfony MessengersequenceDiagram
actor Admin
participant AddAction as BackendContentBlocksAdd
participant Form as SymfonyForm
participant MB as MessengerDefaultBus
participant Cmd as CreateContentBlock
participant Handler as CreateContentBlockHandler
participant Repo as ContentBlockRepository
participant EM as EntityManagerInterface
Admin->>AddAction: HTTP request to add content block
AddAction->>Form: build and handleRequest
Form-->>AddAction: isSubmitted && isValid
AddAction->>Cmd: new CreateContentBlock(formData)
AddAction->>Cmd: set userId
AddAction->>MB: dispatch(Cmd)
MB-->>Handler: __invoke(CreateContentBlock)
Handler->>Handler: getNewExtraId()
Handler->>Repo: getNextIdForLanguage(Cmd.locale)
Handler->>Repo: add(ContentBlock::fromDataTransferObject(Cmd))
Handler->>Cmd: setContentBlockEntity(contentBlock)
Handler->>EM: flush()
MB-->>AddAction: dispatch returns
AddAction-->>Admin: redirect to overview with success
Sequence diagram for deleting a media item via MediaItemManager and MessengersequenceDiagram
actor Admin
participant Action as BackendMediaItemMassAction
participant Manager as MediaItemManager
participant MB as MessengerDefaultBus
participant Cmd as DeleteMediaItem
participant Handler as DeleteMediaItemHandler
participant Repo as MediaItemRepository
participant EM as EntityManagerInterface
Admin->>Action: selects media items and confirms delete
Action->>Manager: delete(MediaItem)
Manager->>Cmd: new DeleteMediaItem(MediaItem)
Manager->>MB: dispatch(Cmd)
MB-->>Handler: __invoke(DeleteMediaItem)
Handler->>Repo: remove(Cmd.mediaItem)
Handler->>EM: flush()
MB-->>Manager: dispatch returns
Manager-->>Action: DeleteMediaItem (for further use if needed)
Action-->>Admin: AJAX success response
Class diagram for updated command handlers and messaging componentsclassDiagram
class MessageBusInterface
class CreateContentBlock {
+int id
+int extraId
+Locale locale
+int userId
+ContentBlock contentBlock
+setContentBlockEntity(ContentBlock contentBlock) void
}
class CreateContentBlockHandler {
-ContentBlockRepository contentBlockRepository
-EntityManagerInterface entityManager
+__construct(ContentBlockRepository contentBlockRepository, EntityManagerInterface entityManager)
+__invoke(CreateContentBlock createContentBlock) void
}
class DeleteMediaItem {
+MediaItem mediaItem
+__construct(MediaItem mediaItem)
}
class DeleteMediaItemHandler {
-MediaItemRepository mediaItemRepository
-EntityManagerInterface entityManager
+__construct(MediaItemRepository mediaItemRepository, EntityManagerInterface entityManager)
+__invoke(DeleteMediaItem deleteMediaItem) void
}
class MediaItemManager {
-MessageBusInterface messageBus
+__construct(MessageBusInterface messageBus)
+delete(MediaItem mediaItem) DeleteMediaItem
}
class CopyContentBlocksToOtherLocale {
+Locale toLocale
+Locale fromLocale
+array extraIdMap
+__construct(Locale toLocale, Locale fromLocale)
}
class CopyContentBlocksToOtherLocaleHandler {
-ContentBlockRepository contentBlockRepository
-EntityManagerInterface entityManager
+__construct(ContentBlockRepository contentBlockRepository, EntityManagerInterface entityManager)
+__invoke(CopyContentBlocksToOtherLocale command) void
}
class SaveSettings {
+string mailEngine
+bool doubleOptIn
+bool requireSubscription
+__construct(ModulesSettings modulesSettings)
}
class SaveSettingsHandler {
-ModulesSettings modulesSettings
+__construct(ModulesSettings modulesSettings)
+__invoke(SaveSettings settings) void
}
CreateContentBlockHandler ..> CreateContentBlock : handles
DeleteMediaItemHandler ..> DeleteMediaItem : handles
CopyContentBlocksToOtherLocaleHandler ..> CopyContentBlocksToOtherLocale : handles
SaveSettingsHandler ..> SaveSettings : handles
MediaItemManager --> MessageBusInterface : uses
MediaItemManager ..> DeleteMediaItem : creates
CreateContentBlockHandler --> EntityManagerInterface : flushes
DeleteMediaItemHandler --> EntityManagerInterface : flushes
CopyContentBlocksToOtherLocaleHandler --> EntityManagerInterface : flushes
class MediaItem
class ContentBlock
class ContentBlockRepository
class MediaItemRepository
class ModulesSettings
class Locale
class EntityManagerInterface
CreateContentBlock --> ContentBlock
CreateContentBlockHandler --> ContentBlockRepository
DeleteMediaItem --> MediaItem
DeleteMediaItemHandler --> MediaItemRepository
SaveSettingsHandler --> ModulesSettings
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The
media_library.manager.itemservice definition still passes two arguments (@messenger.bus.defaultand@event_dispatcher) whileMediaItemManagernow only accepts aMessageBusInterface, so the extraevent_dispatcherargument should be removed to avoid a container wiring error. - There is an inconsistency in how the messenger bus is referenced (
@messenger.bus.defaultin service config vs.messenger.default_busvia$this->get(...)in various actions); aligning on a single service ID/alias will make the configuration clearer and reduce the risk of misconfiguration.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `media_library.manager.item` service definition still passes two arguments (`@messenger.bus.default` and `@event_dispatcher`) while `MediaItemManager` now only accepts a `MessageBusInterface`, so the extra `event_dispatcher` argument should be removed to avoid a container wiring error.
- There is an inconsistency in how the messenger bus is referenced (`@messenger.bus.default` in service config vs. `messenger.default_bus` via `$this->get(...)` in various actions); aligning on a single service ID/alias will make the configuration clearer and reduce the risk of misconfiguration.
## Individual Comments
### Comment 1
<location path="src/Backend/Modules/MediaLibrary/Resources/config/managers.yml" line_range="20-22" />
<code_context>
+ autowire: true
+ autoconfigure: true
public: true
- arguments:
- - "@content_blocks.repository.content_block"
- tags:
</code_context>
<issue_to_address>
**issue (bug_risk):** Service definition for MediaItemManager no longer matches the constructor signature.
The service definition still passes two arguments (`@messenger.bus.default`, `@event_dispatcher`) while the constructor now only accepts a `MessageBusInterface`. This will break container compilation. Please either reintroduce the second constructor argument or, preferably, rely on autowiring and remove the explicit `arguments:` (at least the extra `@event_dispatcher`).
</issue_to_address>
### Comment 2
<location path="src/Frontend/Modules/Mailmotor/Actions/Subscribe.php" line_range="74" />
<code_context>
}
- $this->getContainer()->get('logger')->error('Mailmotor Subcribe Mailchimp error: ' . $reason);
+ $this->getContainer()->get('logger.public')->error('Mailmotor Subcribe Mailchimp error: ' . $reason);
$this->template->assign('mailmotorSubscribeHasFormError', true);
</code_context>
<issue_to_address>
**suggestion (typo):** Log message contains a typo in the word 'Subscribe'.
Since this line is already being updated, please also correct the log message text to fix the typo in `'Mailmotor Subcribe Mailchimp error: '`, e.g. `'Mailmotor Subscribe Mailchimp error: '`.
```suggestion
$this->getContainer()->get('logger.public')->error('Mailmotor Subscribe Mailchimp error: ' . $reason);
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
|
Op verschillende plaatsen voeg je de EntityManager toe. En doe je |
Member
Author
|
Heb het al in aparte taak gestoken |
src/Backend/Modules/MediaGalleries/Domain/MediaGallery/Command/DeleteMediaGalleryHandler.php
Show resolved
Hide resolved
src/Backend/Modules/ContentBlocks/Domain/ContentBlock/Command/CreateContentBlockHandler.php
Show resolved
Hide resolved
added 2 commits
March 19, 2026 10:23
tijsverkoyen
approved these changes
Mar 19, 2026
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.
https://next-app.activecollab.com/108877/projects/62?modal=Task-243505-62
Summary by Sourcery
Replace the legacy SimpleBus command/event bus with Symfony Messenger across the application and adjust related configuration, handlers, and integrations accordingly.
New Features:
Enhancements:
Build: