Presentation Layer
The Presentation Layer transforms application responses into output formats (HTML, JSON) and handles HTTP concerns.
In This Section
- Presenters - Transform QueryResponse to ViewModel
- View Models - Structured data for templates
- HTTP Responses - Response building patterns
- Twig Integration - Template rendering
Layer Responsibilities
- Transform QueryResponse objects into ViewModels
- Apply display formatting (badges, dates, CSS classes)
- Render templates via Twig
- Build HTTP responses with proper headers
Data Flow
Key Patterns
Presenter Pattern: Transform domain data into display-ready formats. Presenters apply formatting, calculate display values, and prepare CSS classes.
Multiple Output Formats: The same QueryResponse can have different presenters for HTML and JSON output.
PresentationContext: Provides user permissions to presenters for conditional display (show/hide buttons based on permissions).