Restructure src/ and tests/ from package-by-type to package-by-domain
All checks were successful
CI / Coding Standards (push) Successful in 43s
CI / PHPStan (push) Successful in 52s
CI / Tests (PHP 8.1) (push) Successful in 47s
CI / Tests (PHP 8.2) (push) Successful in 49s
CI / Tests (PHP 8.3) (push) Successful in 37s
CI / No Debug Code (push) Successful in 2s
All checks were successful
CI / Coding Standards (push) Successful in 43s
CI / PHPStan (push) Successful in 52s
CI / Tests (PHP 8.1) (push) Successful in 47s
CI / Tests (PHP 8.2) (push) Successful in 49s
CI / Tests (PHP 8.3) (push) Successful in 37s
CI / No Debug Code (push) Successful in 2s
All classes are now organised by domain (Availability, Booking, Auth). Each domain package contains its value object, repository, admin controller, REST endpoint, and any shortcode pages under a matching sub-namespace. Cross-cutting wiring (Plugin, AdminMenu, RestRegistrar, ShortcodeRegistrar, Schema) lives at src/ root. Tests mirror the domain structure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
|
||||
- [Project: unsupervised-schedular](project_schedular.md) — WordPress lesson scheduling plugin; initial scaffold created March 2026
|
||||
- [Feedback: Brain\Monkey testing patterns](feedback_brainmonkey.md) — specific API quirks discovered during test setup
|
||||
- [Feedback: Package-by-domain architecture](feedback_architecture.md) — all new code must be organised by domain, never by type
|
||||
|
||||
16
memory/feedback_architecture.md
Normal file
16
memory/feedback_architecture.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Package-by-domain architecture
|
||||
description: New features must be organised as domain packages, not by type (no Admin/, Api/, Data/ etc.)
|
||||
type: feedback
|
||||
---
|
||||
|
||||
Always organise code package-by-domain, not package-by-type.
|
||||
|
||||
**Why:** User explicitly requested the restructure on 2026-03-30. Package-by-type (Admin/, Api/, Data/, Frontend/, Model/, Roles/) was the initial scaffold but was replaced before any real features shipped.
|
||||
|
||||
**How to apply:**
|
||||
- New domain → new directory under `src/<Domain>/` (e.g. `src/Availability/`, `src/Booking/`, `src/Auth/`)
|
||||
- All classes for a domain (value objects, repositories, admin controllers, REST endpoints, shortcode pages) live inside that directory under the sub-namespace `Unsupervised\Schedular\<Domain>\`
|
||||
- Cross-cutting wiring that glues domains together (Plugin, AdminMenu, RestRegistrar, ShortcodeRegistrar, Schema) lives at `src/` root with namespace `Unsupervised\Schedular\`
|
||||
- Tests mirror the domain structure: `tests/Unit/<Domain>/`
|
||||
- Never create `src/Admin/`, `src/Api/`, `src/Data/`, `src/Frontend/`, `src/Model/`, or `src/Roles/` directories
|
||||
@@ -15,5 +15,6 @@ WordPress plugin for instructor/student lesson scheduling. Full scaffold created
|
||||
- REST API (`us-scheduler/v1`) for all front-end interactions; templates are minimal shell divs, JS (vanilla) takes over
|
||||
- Instructors use wp-admin login; students use front-end `[us_student_login]` shortcode calling `wp_signon()`
|
||||
- PSR-4 namespace `Unsupervised\Schedular\` from `src/`
|
||||
- **Package-by-domain architecture** (restructured 2026-03-30): `src/Availability/`, `src/Booking/`, `src/Auth/` — each domain contains its value object, repository, controller, REST endpoint, and any shortcode pages. Cross-cutting wiring (Plugin, AdminMenu, RestRegistrar, ShortcodeRegistrar, Schema) lives at `src/` root. Tests mirror the domain structure under `tests/Unit/<Domain>/`.
|
||||
|
||||
**How to apply:** When adding features, follow the docs/features/ + src/ + tests/Unit/ pattern. Always run `composer test` after changes.
|
||||
**How to apply:** When adding features, create a domain package under `src/<Domain>/` with all related classes, mirror it in `tests/Unit/<Domain>/`, write a feature doc in `docs/features/`, then run `composer test`.
|
||||
|
||||
Reference in New Issue
Block a user