Skip to content

Presentation Layer

The Presentation Layer transforms application responses into output formats (HTML, JSON) and handles HTTP concerns.

In This Section

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

QueryResponse → Presenter → ViewModel → Template → HTTP Response

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).