dev-toolings/superpowers-symfony109 installs
doctrine-relations
Define Doctrine entity relationships (OneToMany, ManyToMany, ManyToOne); configure cascade, orphan removal, multiple entity managers; prevent N+1 queries
How do I install this agent skill?
npx skills add https://github.com/dev-toolings/superpowers-symfony --skill doctrine-relationsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides standard documentation and best practices for managing Doctrine entity relationships in Symfony applications. No malicious patterns or security vulnerabilities were identified.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Doctrine Relations (Symfony)
Use when
- Mapping a
ManyToOne,OneToMany,ManyToManyorOneToOneand choosing the owning side. - Deciding between
cascadeandorphanRemovalfor child entities. - A relation does not persist (only the inverse side was set), or
contains()is slow on a large inverse collection. - Splitting entities across several entity managers.
Default workflow
- Pick the owning side (holds the foreign key,
ManyToOnewithinversedBy) and the inverse side (OneToManywithmappedBy). - Initialize collections with
ArrayCollectionin the constructor, and writeaddX()andremoveX()helpers that keep both sides in sync. - Use
cascade: ['persist']for aggregates saved together, andorphanRemoval: trueonly for true composition. - Mark large inverse collections
fetch: 'EXTRA_LAZY', or test membership from the owning side. - Add fetch joins where a use case reads the relation, to avoid N+1 queries.
- With several entity managers, keep each entity set in one manager and fetch repositories through
ManagerRegistry.
Guardrails
- Doctrine persists what the owning side holds: always set the
ManyToOnereference. - Avoid
cascade: ['remove']on large collections (one DELETE per row), and never useorphanRemovalon shared entities. - A relation cannot span two entity managers.
- For a non-default entity manager, fetch repositories with
ManagerRegistry::getRepository(Entity::class, 'name').
Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
Output contract
- Entity mappings with the owning and inverse sides, cascade and orphan decisions.
- Fetch strategy for large collections and hot paths.
- Result of
doctrine:schema:validate.
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-relations">View doctrine-relations on skillZs</a>