ver. 0.278: Settings + Languages frontend migration, bug fix get_single_settings_value
- Add cached frontend methods to existing Domain repositories (allSettings, getSingleValue, defaultLanguage, activeLanguages, translations) - Convert front\factory\Settings and Languages to facades delegating to Domain repositories - Fix get_single_settings_value() - was hardcoded to 'firm_name', now uses $param correctly - Add CacheHandler stub methods (get/set/exists) to test bootstrap - Establish architectural rule: Domain classes are shared between admin and frontend Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,26 +153,27 @@ Legacy Cleanup
|
||||
|
||||
---
|
||||
|
||||
## Plan wersjonowany
|
||||
## Etapy migracji
|
||||
|
||||
### ver. 0.278 — Settings + Languages Frontend Services
|
||||
### Etap: Settings + Languages — ZREALIZOWANY
|
||||
|
||||
**Cel:** Stworzyć serwisy domenowe dla Settings i Languages, naprawić buga Settings.
|
||||
**Cel:** Dodac metody frontendowe (z cache Redis) do istniejacych repozytoriow Domain.
|
||||
|
||||
**NOWE:**
|
||||
- `Domain/Settings/SettingsFrontendService.php` — `allSettings()`, `getSingleValue($param)` (FIX: używa poprawnie $param)
|
||||
- `Domain/Languages/LanguagesFrontendService.php` — `defaultLanguage()`, `activeLanguages()`, `translations($lang)`
|
||||
- Testy: `SettingsFrontendServiceTest`, `LanguagesFrontendServiceTest`
|
||||
**DODANE METODY (do istniejacych klas):**
|
||||
- `Domain/Settings/SettingsRepository` — `allSettings($skipCache)`, `getSingleValue($param)` (FIX: uzywa poprawnie $param)
|
||||
- `Domain/Languages/LanguagesRepository` — `defaultLanguage()`, `activeLanguages()`, `translations($lang)`
|
||||
- Testy: dopisane do `SettingsRepositoryTest` (6 testow), `LanguagesRepositoryTest` (7 testow)
|
||||
|
||||
**ZMIANA:**
|
||||
- `front/factory/Settings` → fasada delegująca do `SettingsFrontendService`
|
||||
- `front/factory/Languages` → fasada delegująca do `LanguagesFrontendService`
|
||||
- `front/factory/Settings` → fasada delegujaca do `SettingsRepository`
|
||||
- `front/factory/Languages` → fasada delegujaca do `LanguagesRepository`
|
||||
- `tests/bootstrap.php` — uzupelniony stub CacheHandler o `get()`/`set()`/`exists()`
|
||||
|
||||
**BUG FIX:** `get_single_settings_value()` — zmiana `['param' => 'firm_name']` na `['param' => $param]`
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.279 — Category Frontend Service
|
||||
### Etap: Category Frontend Service
|
||||
|
||||
**Cel:** Migracja `front\factory\ShopCategory` do Domain.
|
||||
|
||||
@@ -186,7 +187,7 @@ Legacy Cleanup
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.280 — Banners, Menu, Pages, Articles, Layouts Frontend Services
|
||||
### Etap: Banners, Menu, Pages, Articles, Layouts Frontend Services
|
||||
|
||||
**Cel:** Migracja pozostałych fabryk "liściowych".
|
||||
|
||||
@@ -205,7 +206,7 @@ Legacy Cleanup
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.281 — Promotion Engine (rozbicie circular dependency)
|
||||
### Etap: Promotion Engine (rozbicie circular dependency)
|
||||
|
||||
**Cel:** Przeniesienie silnika promocji do Domain. Rozbicie cyklicznej zależności `shop\Promotion ↔ front\factory\ShopPromotion`.
|
||||
|
||||
@@ -231,7 +232,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.282 — Product Frontend Service
|
||||
### Etap: Product Frontend Service
|
||||
|
||||
**Cel:** Migracja `front\factory\ShopProduct` i statycznych metod `shop\Product` do Domain.
|
||||
|
||||
@@ -245,11 +246,11 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
- `front/factory/ShopProduct` → fasada
|
||||
- `shop/Product` statyczne metody → fasady do `ProductFrontendService`
|
||||
|
||||
**UWAGA:** Konstruktor `shop\Product`, `getFromCache()`, `calculate_basket_product_price()` — zostają na razie (instancyjne, używane w szablonach). Migracja w ver. 0.286.
|
||||
**UWAGA:** Konstruktor `shop\Product`, `getFromCache()`, `calculate_basket_product_price()` — zostają na razie (instancyjne, używane w szablonach). Migracja w etapie "Product Instance + Cache".
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.283 — Client Authentication (Security Fix)
|
||||
### Etap: Client Authentication (Security Fix)
|
||||
|
||||
**Cel:** Migracja `front\factory\ShopClient` + NAPRAWIENIE hardcoded password bypass.
|
||||
|
||||
@@ -267,7 +268,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.284 — Transport, Payment, Coupon Frontend Services
|
||||
### Etap: Transport, Payment, Coupon Frontend Services
|
||||
|
||||
**Cel:** Frontend serwisy dla transportu, płatności i kuponów.
|
||||
|
||||
@@ -285,7 +286,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.285 — Basket Service
|
||||
### Etap: Basket Service
|
||||
|
||||
**Cel:** Migracja logiki koszyka do `Domain\Basket\BasketService`.
|
||||
|
||||
@@ -305,7 +306,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.286 — shop\Product Instance + Cache
|
||||
### Etap: shop\Product Instance + Cache
|
||||
|
||||
**Cel:** Refaktoring konstruktora `shop\Product` i `getFromCache()`.
|
||||
|
||||
@@ -321,7 +322,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.287 — Order Creation Frontend Service
|
||||
### Etap: Order Creation Frontend Service
|
||||
|
||||
**Cel:** Migracja `front\factory\ShopOrder::basket_save()` (~180 linii).
|
||||
|
||||
@@ -337,7 +338,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.288 — Payment Webhook Service
|
||||
### Etap: Payment Webhook Service
|
||||
|
||||
**Cel:** Wyodrębnienie webhooków płatności z `front\controls\ShopOrder`.
|
||||
|
||||
@@ -356,7 +357,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.289 — shop\Order Instance + Apilo Service
|
||||
### Etap: shop\Order Instance + Apilo Service
|
||||
|
||||
**Cel:** Refaktoring `shop\Order` instancyjnych metod + wyodrębnienie integracji Apilo.
|
||||
|
||||
@@ -374,7 +375,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.290 — Frontend App + Controllers (DI layer)
|
||||
### Etap: Frontend App + Controllers (DI layer)
|
||||
|
||||
**Cel:** Stworzenie `front\App` (wzorowanego na `admin\App`) z mapą kontrolerów i DI.
|
||||
|
||||
@@ -390,7 +391,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.291 — Site Layout Engine
|
||||
### Etap: Site Layout Engine
|
||||
|
||||
**Cel:** Refaktoring `front\view\Site::show()` (~600 linii) na testowalny `LayoutEngine`.
|
||||
|
||||
@@ -406,7 +407,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.292 — Entry Point Unification
|
||||
### Etap: Entry Point Unification
|
||||
|
||||
**Cel:** Ujednolicenie bootstrapu `index.php` i `ajax.php`.
|
||||
|
||||
@@ -420,7 +421,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
---
|
||||
|
||||
### ver. 0.293 — Legacy Cleanup
|
||||
### Etap: Legacy Cleanup
|
||||
|
||||
**Cel:** Finalne porządki.
|
||||
|
||||
@@ -440,26 +441,26 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
|
||||
## Podsumowanie
|
||||
|
||||
| Wersja | Zakres | Priorytet | Nowe klasy Domain | Testy |
|
||||
|--------|--------|-----------|-------------------|-------|
|
||||
| 0.278 | Settings + Languages | FUNDAMENT | 2 serwisy | 2 |
|
||||
| 0.279 | Category Frontend | WYSOKI | 1 serwis | 1 |
|
||||
| 0.280 | Banners/Menu/Pages/Articles/Layouts | ŚREDNI | 5 serwisów | 5 |
|
||||
| 0.281 | Promotion Engine | KRYTYCZNY | 1 serwis | 1 |
|
||||
| 0.282 | Product Frontend | KRYTYCZNY | 1 serwis | 1 |
|
||||
| 0.283 | Client/Auth (security fix) | KRYTYCZNY | 1 serwis | 1 |
|
||||
| 0.284 | Transport/Payment/Coupon | WYSOKI | 3 serwisy | 3 |
|
||||
| 0.285 | Basket Service | WYSOKI | 1 serwis | 1 |
|
||||
| 0.286 | Product Instance + Cache | ŚREDNI | 1 loader | 1 |
|
||||
| 0.287 | Order Creation | WYSOKI | 1 serwis | 1 |
|
||||
| 0.288 | Payment Webhooks | WYSOKI | 1 serwis | 1 |
|
||||
| 0.289 | Order Instance + Apilo | ŚREDNI | 2 serwisy | 2 |
|
||||
| 0.290 | Frontend App + Controllers | WYSOKI | App + 3 kontrolery | 3 |
|
||||
| 0.291 | Layout Engine | ŚREDNI | 1 engine | 1 |
|
||||
| 0.292 | Entry Point Unification | ŚREDNI | Bootstrap + PostProcessor | 1 |
|
||||
| 0.293 | Legacy Cleanup | NISKI | — | — |
|
||||
| Etap | Zakres | Priorytet | Nowe klasy Domain | Testy |
|
||||
|------|--------|-----------|-------------------|-------|
|
||||
| Settings + Languages | Fundamenty | FUNDAMENT | 2 serwisy | 2 |
|
||||
| Category Frontend | Kategorie | WYSOKI | 1 serwis | 1 |
|
||||
| Banners/Menu/Pages/Articles/Layouts | Treści | ŚREDNI | 5 serwisów | 5 |
|
||||
| Promotion Engine | Promocje | KRYTYCZNY | 1 serwis | 1 |
|
||||
| Product Frontend | Produkty | KRYTYCZNY | 1 serwis | 1 |
|
||||
| Client/Auth (security fix) | Klienci | KRYTYCZNY | 1 serwis | 1 |
|
||||
| Transport/Payment/Coupon | Dostawa/Płatności | WYSOKI | 3 serwisy | 3 |
|
||||
| Basket Service | Koszyk | WYSOKI | 1 serwis | 1 |
|
||||
| Product Instance + Cache | Produkt cache | ŚREDNI | 1 loader | 1 |
|
||||
| Order Creation | Zamówienia | WYSOKI | 1 serwis | 1 |
|
||||
| Payment Webhooks | Webhooki | WYSOKI | 1 serwis | 1 |
|
||||
| Order Instance + Apilo | Zamówienie + Apilo | ŚREDNI | 2 serwisy | 2 |
|
||||
| Frontend App + Controllers | DI layer | WYSOKI | App + 3 kontrolery | 3 |
|
||||
| Layout Engine | Silnik layoutu | ŚREDNI | 1 engine | 1 |
|
||||
| Entry Point Unification | Entry points | ŚREDNI | Bootstrap + PostProcessor | 1 |
|
||||
| Legacy Cleanup | Porządki | NISKI | — | — |
|
||||
|
||||
**Łącznie:** 16 wersji, ~24 nowe klasy Domain, ~25 plików testowych
|
||||
**Łącznie:** 16 etapów, ~24 nowe klasy Domain, ~25 plików testowych
|
||||
|
||||
### Wzorce do przestrzegania (z migracji admin)
|
||||
- Konstruktor DI z `$db` (medoo)
|
||||
@@ -468,8 +469,9 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
- Testy PHPUnit z mockami medoo
|
||||
- Namespace `\Domain\*` → `autoload/Domain/*/`
|
||||
- Namespace `\front\Controllers\` → `autoload/front/Controllers/`
|
||||
- **Klasy Domain sa wspolne dla admin i frontendu** — NIE tworzymy osobnych FrontendService/AdminService. Metody frontendowe (z cache Redis) dodajemy do istniejacych repozytoriow/serwisow Domain. Klasy sa ladowane lazy (instancja tworzona dopiero przy wywolaniu), wiec nie wplywaja na wydajnosc.
|
||||
|
||||
### Weryfikacja po każdej wersji
|
||||
### Weryfikacja po każdym etapie
|
||||
1. `composer test` (pełny suite PHPUnit)
|
||||
2. Manualne sprawdzenie frontendu: strona główna, kategoria, produkt, koszyk, zamówienie
|
||||
3. Sprawdzenie AJAX: dodawanie do koszyka, zmiana transportu, kupon
|
||||
|
||||
Reference in New Issue
Block a user