Skip to content

EffectSource

A driver-specific package’s hook into RecorderMiddleware’s recording lifecycle, for an ORM/driver whose own instrumentation seam is process-scoped rather than per-connection — Propulsion’s addQueryObserver() being the motivating case (see quioteframework/replay-propulsion’s own PropulsionEffectSource): a single observer is registered once at boot, and needs telling, for the duration of one request, which correlation id’s queries belong to which EffectLedger.

A driver whose recorder is instead a per-request decorator constructed around a specific connection (the PDO/Doctrine/Eloquent/Cycle shape) has no need of this seam at all — it just takes an EffectLedger directly in its constructor, wherever that connection gets built.

packages/replay itself ships no implementation of this interface and has no compile-time dependency on any ORM; a driver package registers one via EffectSourceRegistry::register() from its own plugin.

interface EffectSource

Implemented byCycleEffectSource, EloquentEffectSource, IsolatesFromLedger
SourceRecording/EffectSource.php
MethodDescription
activate(string $correlationId, EffectLedger $ledger): voidCalled once, before $handler->handle(), for every request RecorderMiddleware buffers.
deactivate(string $correlationId): voidCalled once, as soon as $handler->handle() returns or throws.

abstract public function activate(string $correlationId, EffectLedger $ledger): void

Called once, before $handler->handle(), for every request RecorderMiddleware buffers.

ParameterTypeDescription
$correlationIdstring
$ledgerEffectLedger

abstract public function deactivate(string $correlationId): void

Called once, as soon as $handler->handle() returns or throws.

ParameterTypeDescription
$correlationIdstring