home / skills / makfly / superpowers-symfony / doctrine-fetch-modes
This skill helps you safely evolve Symfony Doctrine models and schema, improving integrity, performance, and rollout discipline through targeted fetch mode
npx playbooks add skill makfly/superpowers-symfony --skill doctrine-fetch-modesReview the files below or copy the command above to add this skill to your agents.
---
name: symfony:doctrine-fetch-modes
allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
description: Evolve Symfony Doctrine models and schema safely with integrity, performance, and rollout discipline. Use for doctrine fetch modes tasks.
---
# Doctrine Fetch Modes (Symfony)
## Use when
- Designing entity relations or schema evolution.
- Improving Doctrine correctness/performance.
## Default workflow
1. Model ownership/cardinality and transactional boundaries.
2. Apply mapping/schema changes with migration safety.
2. Tune fetch/query behavior for hot paths.
2. Verify lifecycle behavior with targeted tests.
## Guardrails
- Keep owning/inverse sides coherent.
- Avoid destructive migration jumps in one release.
- Eliminate accidental N+1 and over-fetching.
## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
## Output contract
- Entity/migration changes.
- Integrity and performance decisions.
- Validation outcomes and rollback notes.
## References
- `reference.md`
- `docs/complexity-tiers.md`
This skill helps evolve Symfony Doctrine models and database schema with focus on fetch modes, integrity, and rollout discipline. It guides safe mapping changes, migration planning, and fetch behavior tuning to avoid N+1 and over-fetching. Use it to balance correctness, performance, and predictable deployments.
The skill inspects entity relationships, current fetch strategies, and migration risks to produce concrete change suggestions. It recommends ownership and cardinality adjustments, safe migration steps, and targeted query/fetch tuning for hot paths. It outputs entity and migration edits, validation results, and rollback notes for each proposed change.
How do I avoid a destructive migration that impacts live traffic?
Split the change: add nullable columns or new tables, backfill data, switch application code to read the new shape, then make columns non-nullable in a subsequent release.
When should I prefer EXTRA_LAZY over LAZY?
Use EXTRA_LAZY for very large collections where operations like count/contains should not initialize the whole collection; use LAZY for typical collections where proxies are sufficient.