doctrine-events

Installation
SKILL.md

Doctrine Events (Symfony)

Use when

  • You need side effects on entity persistence (timestamps, slugs, search indexing, notifications).
  • Choosing between lifecycle callbacks, entity listeners, and global lifecycle listeners.

Default workflow

  1. Pick the narrowest mechanism: callback (one entity, no deps) → entity listener (one entity, needs services) → lifecycle listener (cross-cutting, all entities).
  2. Wire it with attributes (#[ORM\HasLifecycleCallbacks], #[AsEntityListener], #[AsDoctrineListener]).
  3. Type the event argument by its per-event class (PostPersistEventArgs, PreUpdateEventArgs, …).
  4. Verify the side effect fires with a targeted functional test against a real DB.

Guardrails

Installs
1
First Seen
Jul 20, 2026