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

650 B

globs, description
globs description
["**/Data/**/*Repository.php"] 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.