@@ -9,33 +9,40 @@ reviews:
99 high_level_summary_in_walkthrough : false
1010 poem : false
1111 path_instructions :
12- - path : " src/Domain/**"
13- instructions : |
14- You are reviewing PHP domain-layer code. Enforce strict domain purity:
15- - ❌ Do not allow infrastructure persistence side effects here.
16- - Flag ANY usage of Doctrine persistence APIs, especially:
17- - $entityManager->flush(...), $this->entityManager->flush(...)
18- - $em->persist(...), $em->remove(...)
19- - direct transaction control ($em->beginTransaction(), commit(), rollback())
20- - If found, request moving these calls to application-layer Command handlers or background Jobs.
21- - Also flag repositories in Domain that invoke flush/transactional logic; Domain repositories should be abstractions without side effects.
22- - Encourage domain events/outbox or return-values to signal write-intent, leaving orchestration to Commands/Jobs.
23- - Only exception to this rule is when the service is orchestrating multiple domain services with complex use cases
12+ - path : " src/Domain/**"
13+ instructions : |
14+ You are reviewing PHP domain-layer code. Enforce strict domain purity:
15+ - ❌ Do not allow persistence or transaction side effects here.
16+ - Flag ANY usage of Doctrine persistence APIs, especially:
17+ - `$entityManager->flush(...)`, `$this->entityManager->flush(...)`
18+ - `$em->persist(...)`, `$em->remove(...)`
19+ - `$em->beginTransaction()`, `$em->commit()`, `$em->rollback()`
20+ - ✅ Accessing Doctrine *metadata*, *schema manager*, or *read-only schema info* is acceptable
21+ as long as it does not modify state or perform writes.
22+ - ⚠️ If code is invoking actual table-creation, DDL execution, or schema synchronization,
23+ then request moving that to the Infrastructure or Application layer (e.g. MessageHandler).
24+ - Also flag repositories in Domain that invoke flush/transactional logic;
25+ Domain repositories should be abstractions without side effects.
26+ - Encourage using domain events or return-values to signal intent to write,
27+ leaving persistence orchestration to Commands/Jobs.
2428
25- - path : " src/**/Command/**"
26- instructions : |
27- Application layer (Commands/Handlers) is the right place to coordinate persistence.
28- - ✅ It is acceptable to call $entityManager->flush() here.
29- - Check that flush is used atomically (once per unit of work) after all domain operations.
30- - Ensure no domain entity or domain service is calling flush; only the handler orchestrates it.
31- - Prefer $em->transactional(...) or explicit try/catch with rollback on failure.
29+ - path : " src/**/Command/**"
30+ instructions : |
31+ Application layer (Commands/Handlers) is the right place to coordinate persistence.
32+ - ✅ It is acceptable to call $entityManager->flush() here.
33+ - Check that flush is used atomically (once per unit of work) after all domain operations.
34+ - Ensure no domain entity or domain service is calling flush; only the handler orchestrates it.
35+ - Prefer $em->transactional(...) or explicit try/catch with rollback on failure.
3236
33- - path : " src/**/MessageHandler/**"
34- instructions : |
35- Background jobs/workers may perform persistence.
36- - ✅ Allow $entityManager->flush() here when the job is the orchestration boundary.
37- - Verify idempotency and that flush frequency is appropriate (batching where practical).
38- - Ensure no domain-layer code invoked by the job performs flush/transaction control.
37+ - path : " src/**/MessageHandler/**"
38+ instructions : |
39+ Background jobs/workers may perform persistence and schema management.
40+ - ✅ Allow `$entityManager->flush()` when the job is the orchestration boundary.
41+ - ✅ Allow table creation, migration, or schema synchronization (e.g. via Doctrine SchemaTool or SchemaManager),
42+ as this is considered infrastructure-level orchestration.
43+ - Verify idempotency for schema operations — e.g., check if a table exists before creating.
44+ - Ensure domain-layer code invoked by the job remains free of persistence calls.
45+ - Batch flush operations where practical.
3946
4047 auto_review :
4148 enabled : true
0 commit comments