dev-toolings/superpowers-symfony117 installs
doctrine-events
React to Doctrine entity lifecycle in Symfony with attribute listeners (#[AsDoctrineListener]/#[AsEntityListener], ORM 3) and lifecycle callbacks
How do I install this agent skill?
npx skills add https://github.com/dev-toolings/superpowers-symfony --skill doctrine-eventsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides guidelines and templates for implementing Doctrine entity lifecycle listeners in Symfony (ORM 3). No security risks or malicious patterns were identified.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Doctrine Events (Symfony)
Use when
- You need side effects on entity persistence (timestamps, slugs, search indexing, notifications).
- Migrating an
EventSubscriberInterfaceDoctrine subscriber to ORM 3. - Choosing between lifecycle callbacks, entity listeners, and global lifecycle listeners.
Default workflow
- Pick the narrowest mechanism: callback (one entity, no deps) → entity listener (one entity, needs services) → lifecycle listener (cross-cutting, all entities).
- Wire it with attributes (
#[ORM\HasLifecycleCallbacks],#[AsEntityListener],#[AsDoctrineListener]). - Type the event argument by its per-event class (
PostPersistEventArgs,PreUpdateEventArgs, …). - Verify the side effect fires with a targeted functional test against a real DB.
Guardrails
- ORM 3.0 removed
EventSubscriberInterfaceDoctrine subscribers — never reintroduce them. - Type-check the entity early in a global lifecycle listener (it fires for every entity).
- Never call
flush()inside a Doctrine event handler — it corrupts the in-flight unit of work. preUpdateis restricted: change fields only via$args->setNewValue(), never touch associations.
Progressive disclosure
- Use this file for execution posture and risk controls.
- Open
reference.mdfor the three mechanisms, the event-args matrix, and migration from subscribers.
Output contract
- Listener/callback class with the correct attribute.
- Justification for the chosen mechanism.
- Validation outcomes (test that the side effect fired).
References
reference.md
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/dev-toolings/superpowers-symfony/doctrine-events">View doctrine-events on skillZs</a>