replace controller logic with dedicated handler and service classes (CQRS-Lite)#91
Draft
solverat wants to merge 26 commits into
Draft
replace controller logic with dedicated handler and service classes (CQRS-Lite)#91solverat wants to merge 26 commits into
solverat wants to merge 26 commits into
Conversation
…d handler classes (CQRS-Lite)
…inability (CQRS compliance)
…s, updating type strictness, and cleaning up handlers
…andling consistency
…er actions for CQRS compliance
…rollers for consistency and maintainability
26c7f18 to
8d55228
Compare
…and service dependencies
…ler and payload for improved filter handling
…ss controllers, centralize edit lock logic in AdminExceptionListener
…nFailedException, referencing AdminExceptionListener for improved clarity
…pository, and dependencies for improved dashboard management
…tisticsService, refactor handlers and dependencies for improved maintainability
…resolvers, and controllers for improved consistency and maintainability
…ails for AdminOperationFailedException and ElementLockedException
…oad and custom logo upload, refactor related handlers and controllers for improved maintainability
…within `AssetUploadService`
…andlers and payloads to improve robustness
…for improved data robustness and error prevention
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.
Extracts all business logic from admin controllers into dedicated handler, service, and enricher classes.
Controllers are now thin dispatch layers: they receive a typed Payload, pass it to a Handler, and return the result. Request parsing no longer happens inside controllers or handlers.
Changes 🤯
Handlers & Payloads
Every controller action now has a corresponding Handler (invokable) and a Payload implementing
ExtJsPayloadInterface.The payload is resolved from the request by a new
ExtJsValueResolver, keeping Request out of handlers entirely.Common payload shapes (
IdQueryPayload,IdBodyPayload,EmptyPayload, etc.) live insrc/Payload/Common/.File uploads (
add-asset,add-asset-compatibility,upload-custom-logo,replace-asset) are covered too, multipart and base64 alike.Services
Business logic shared across handlers was extracted into service classes under
src/Service/:Document/DocumentPayloadMapper,DocumentPersistenceCoordinatorAsset/AssetPayloadMapper,AssetUploadServiceDataObject/DataObjectPayloadMapperGrid/GridColumnConfigService,GridBatchService,GridExportServiceElement/EditLockService,Element/SessionServiceLogin/LoginPageServicePortal/DashboardServiceAdmin/AdminSettingsService,AdminStatisticsServiceNotification/NotificationFilterParserWorkflow/WorkflowElementResolverTranslation/AdminSearchTermResolverRepository
Persistence-only classes under
src/Repository/:DashboardRepositoryEnrichers
Post-processing of element data was split into enrichers under
src/Enricher/:Element/AdminStyleEnricher,Element/UserNamesEnricherDocument/DocumentMetaEnricher,DraftEnricher,PropertiesEnricher,TranslationEnricherDataObject/DraftEnricher,CustomLayoutEnricherPermissions
Access control moved from manual
checkPermission()calls inside controller methods to#[IsGranted]attributes on actions, backed byPermissionVoter.HTTP layer
ExtJsValueResolverresolves Payload objects from the request viafromRequest()ApiResponseDTO for consistent JSON response shapeAdminExceptionListenercentralizes exception-to-response mapping, includingElementLockedException(editlock dialog) andAdminOperationFailedException(recoverable business-rule failures), instead of per-controller try/catchExtJS xaction dispatching
ExtJS CRUD endpoints that send a single URL with an xaction parameter (create, update, destroy) are now handled via
$this->forward()to dedicated per-action methods.Each target action has its own typed Payload, Handler, and
#[IsGranted]attribute instead of a branching switch statement inside one fat action.Removed
src/Controller/Traits/ApplySchedulerDataTrait,UserNameTraitsrc/EventListener/Traits/ControllerTypeTrait