Files
ai-chat/.continue/rules/doctrine-repository-best-practices.md
T
2026-06-10 18:22:27 +02:00

7 lines
650 B
Markdown

---
globs: '["**/Data/**/*Repository.php"]'
description: Prevents the common error of using invalid Doctrine ORM attributes
in Repository classes
---
When creating Doctrine repositories, NEVER use #[ORM\EntityManager] as this is not a valid Doctrine mapping attribute and causes runtime errors. Repositories must only be instantiated via Dependency Injection with EntityManagerInterface in their constructor. Valid ORM attributes for Repositories include: none (standard), or optionally #[ORM\HasEntityListeners] if needed. Mapping attributes like #[ORM\Entity], #[ORM\Table], #[ORM\JoinColumn] are ONLY for Entity classes, not Repository classes.