feat(domain): Domain\Scontainers + Domain\Banners repositories z wrapper delegation

Phase 3 complete:
- ScontainersRepository: containerDetails, containerSave, containerDelete, scontainerByLang
- BannersRepository: bannerDetails, bannerSave, bannerDelete, activeBanners, mainBanner
- 4 legacy factories converted to thin wrappers delegating to Domain repos

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 18:04:42 +02:00
parent 7949e9b6a3
commit 73ff0ca5b6
11 changed files with 612 additions and 286 deletions

View File

@@ -0,0 +1,115 @@
---
phase: 03-domain-scontainers-banners
plan: 01
subsystem: domain
tags: [medoo, repository, scontainers, banners, wrapper-delegation]
requires:
- phase: 01-infrastructure
provides: PSR-4 autoloader for Domain\ namespace
provides:
- Domain\Scontainers\ScontainersRepository
- Domain\Banners\BannersRepository
- Wrapper delegation pattern (first usage in project)
affects: [phase-10-admin-banners-authors-scontainers, phase-15-front-pages-menu-banners-scontainers]
tech-stack:
added: []
patterns: [wrapper-delegation, domain-repository-with-cache]
key-files:
created:
- autoload/Domain/Scontainers/ScontainersRepository.php
- autoload/Domain/Banners/BannersRepository.php
modified:
- autoload/admin/factory/class.Scontainers.php
- autoload/admin/factory/class.Banners.php
- autoload/front/factory/class.Scontainers.php
- autoload/front/factory/class.Banners.php
key-decisions:
- "Wrapper delegation pattern: factory static methods delegate to repo instances via global $mdb"
- "Front factories pass $lang[0] explicitly — repositories do not use global $lang"
- "Caching migrated from \\Cache:: to \\Shared\\Cache\\CacheHandler:: in repository layer"
patterns-established:
- "Wrapper delegation: global $mdb; $repo = new \\Domain\\X\\XRepository($mdb); return $repo->method()"
- "Front factory passes language ID explicitly to repository"
duration: ~2min
started: 2026-04-04T00:00:00Z
completed: 2026-04-04T00:00:00Z
---
# Phase 3 Plan 01: Scontainers + Banners Repositories Summary
**Domain repositories for Scontainers and Banners with wrapper delegation in all 4 legacy factories.**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~2min |
| Tasks | 2 completed (delegated) |
| Files created | 2 |
| Files modified | 4 |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: ScontainersRepository exists with all methods | Pass | 5 methods (incl. constructor), 110 lines |
| AC-2: BannersRepository exists with all methods | Pass | 6 methods (incl. constructor), 148 lines |
| AC-3: Legacy admin factories delegate to repositories | Pass | 6 static methods → thin wrappers |
| AC-4: Legacy front factories delegate to repositories | Pass | 3 static methods → thin wrappers, $lang[0] passed explicitly |
## Accomplishments
- Created ScontainersRepository with containerDetails, containerSave, containerDelete, scontainerByLang
- Created BannersRepository with bannerDetails, bannerSave, bannerDelete, activeBanners, mainBanner
- Established wrapper delegation pattern — first usage in the project, template for all future phases
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `autoload/Domain/Scontainers/ScontainersRepository.php` | Created | Domain repository for scontainers CRUD + cached front read |
| `autoload/Domain/Banners/BannersRepository.php` | Created | Domain repository for banners CRUD + cached active/main banner |
| `autoload/admin/factory/class.Scontainers.php` | Modified | Wrapper: 3 methods delegate to ScontainersRepository |
| `autoload/admin/factory/class.Banners.php` | Modified | Wrapper: 3 methods delegate to BannersRepository |
| `autoload/front/factory/class.Scontainers.php` | Modified | Wrapper: 1 method delegates with $lang[0] |
| `autoload/front/factory/class.Banners.php` | Modified | Wrapper: 2 methods delegate with $lang[0] |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| Wrapper creates new repo instance per call | Matches static factory pattern, no singleton needed | Simple, no state leaks between calls |
| Front repos use CacheHandler, not \Cache | Aligns with Shared layer conventions | Consistent caching across Domain layer |
| $lang[0] passed as parameter, not global in repo | Repositories should not depend on globals | Cleaner, testable API |
## Deviations from Plan
None — plan executed exactly as written.
## Issues Encountered
None.
## Next Phase Readiness
**Ready:**
- Domain\Scontainers and Domain\Banners available for Admin controllers (Phase 10)
- Wrapper delegation pattern established for future Domain phases (4, 5)
**Concerns:**
- None
**Blockers:**
- None
---
*Phase: 03-domain-scontainers-banners, Plan: 01*
*Completed: 2026-04-04*