Projections with State
PHP Event Sourcing Stateful Projections
The Problem
Projection State
Passing State Inside Projection
#[ProjectionV2('ticket_counter')]
#[FromAggregateStream(Ticket::class)]
class TicketCounterProjection
{
#[EventHandler]
public function when(
TicketWasRegistered $event,
#[ProjectionState] TicketCounterState $state
): TicketCounterState {
return $state->increase();
}
}Fetching the State from Outside
Global Projection State
Partitioned Projection State (Enterprise)
Multi-Stream Partitioned Projections (Enterprise)
High-Performance Projections with Flush State (Enterprise)
Demo
Last updated
Was this helpful?