ver. 0.279: Newsletter frontend migration, Languages facade elimination, bug fix newsletter_unsubscribe
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,9 +36,9 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
| ShopPaymentMethod | ZMIGROWANA (Domain) | — |
|
||||
| ShopStatuses | ZMIGROWANA (Domain) | — |
|
||||
| Scontainers | ZMIGROWANA (Domain) | — |
|
||||
| Newsletter | CZĘŚCIOWO zmigrowana | ŚREDNI |
|
||||
| Newsletter | ZMIGROWANA (Domain) — usunięta | — |
|
||||
| Settings | Fasada (BUG: get_single_settings_value ignoruje $param) | NISKI |
|
||||
| Languages | Fasada | NISKI |
|
||||
| Languages | USUNIĘTA — przepięta na Domain | — |
|
||||
| Layouts | Fasada | NISKI |
|
||||
| Banners | Fasada | NISKI |
|
||||
| Menu | Fasada | NISKI |
|
||||
@@ -51,7 +51,8 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
|-------|--------|
|
||||
| Site | KRYTYCZNY — show() ~600 linii, pattern substitution engine |
|
||||
| ShopCategory | VIEW z logiką routingu (infinite scroll vs pagination) |
|
||||
| Articles, Banners, Languages, Menu, Newsletter, Scontainers | Czyste VIEW |
|
||||
| Articles, Banners, Menu, Scontainers | Czyste VIEW |
|
||||
| Languages, Newsletter | PRZENIESIONE do `front\Views\` (nowy namespace) |
|
||||
| ShopClient, ShopOrder, ShopPaymentMethod | Czyste VIEW |
|
||||
| ShopTransport | PUSTA klasa (placeholder) |
|
||||
|
||||
@@ -109,7 +110,7 @@ articles(8), banner(2), controls(1), menu(4), newsletter(2), scontainers(1), sho
|
||||
|
||||
1. **KRYTYCZNY** `front\factory\ShopClient::login()` — hardcoded password bypass `'Legia1916'`
|
||||
2. `front\factory\Settings::get_single_settings_value()` — ignoruje `$param`, zawsze zwraca `firm_name`
|
||||
3. `front\factory\Newsletter::newsletter_unsubscribe()` — błędna składnia SQL w delete
|
||||
3. ~~`front\factory\Newsletter::newsletter_unsubscribe()` — błędna składnia SQL w delete~~ **NAPRAWIONE** — `NewsletterRepository::unsubscribe()` z poprawną składnią medoo `delete()`
|
||||
4. `cms\Layout::__get()` — referuje nieistniejące `$this->data`
|
||||
5. `shop\Search` — typo w use: `shop\Produt` (brak 'c')
|
||||
|
||||
@@ -173,6 +174,33 @@ Legacy Cleanup
|
||||
|
||||
---
|
||||
|
||||
### Etap: Newsletter Frontend — ZREALIZOWANY
|
||||
|
||||
**Cel:** Przeniesienie logiki frontendowej z `front\factory\Newsletter` do `Domain\Newsletter\NewsletterRepository`. Migracja view do nowego namespace `front\Views`.
|
||||
|
||||
**DODANE METODY (do istniejącej klasy `NewsletterRepository`):**
|
||||
- `unsubscribe(string $hash): bool` — FIX: poprawna składnia medoo `delete()` (2 args zamiast 3)
|
||||
- `confirmSubscription(string $hash): bool`
|
||||
- `getHashByEmail(string $email): ?string`
|
||||
- `removeByEmail(string $email): bool`
|
||||
- `signup(string $email, string $serverName, bool $ssl, array $settings): bool`
|
||||
- `sendQueued(int $limit, string $serverName, bool $ssl, string $unsubscribeLabel): bool`
|
||||
- Konstruktor rozszerzony o opcjonalne: `ArticleRepository`, `NewsletterPreviewRenderer` (lazy-init)
|
||||
- Testy: 10 nowych testów w `NewsletterRepositoryTest`
|
||||
|
||||
**ZMIANA:**
|
||||
- `front/factory/Newsletter` → USUNIĘTA (logika przeniesiona do `NewsletterRepository`)
|
||||
- `front/view/Newsletter` → USUNIĘTA, zastąpiona przez `front/Views/Newsletter` (nowy namespace, bez `class.` prefix)
|
||||
- `front/controls/Newsletter` → thin wrapper na `NewsletterRepository`
|
||||
- `front/view/Site::show()` → `\front\Views\Newsletter::render()`
|
||||
- `index.php` → `$newsletterRepo->sendQueued()`
|
||||
- `front/factory/ShopClient` (4 miejsca) → `NewsletterRepository::templateByName()`
|
||||
- `tests/bootstrap.php` — dodane stuby: `S::email_check()`, `S::get_session()`, `S::set_session()`
|
||||
|
||||
**BUG FIX:** `newsletter_unsubscribe()` — medoo `delete()` wywoływane z 3 argumentami zamiast 2
|
||||
|
||||
---
|
||||
|
||||
### Etap: Category Frontend Service
|
||||
|
||||
**Cel:** Migracja `front\factory\ShopCategory` do Domain.
|
||||
@@ -435,7 +463,7 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
- PHPDoc do wszystkich nowych klas Domain z `@since`
|
||||
- Aktualizacja `tests/bootstrap.php`
|
||||
- BUG FIX: `shop\Search` — typo `shop\Produt` → `shop\Product`
|
||||
- BUG FIX: `front\factory\Newsletter::newsletter_unsubscribe()` — poprawka SQL
|
||||
- ~~BUG FIX: `front\factory\Newsletter::newsletter_unsubscribe()` — poprawka SQL~~ **ZREALIZOWANE** w etapie Newsletter Frontend
|
||||
|
||||
---
|
||||
|
||||
@@ -471,6 +499,16 @@ front\factory\ShopPromotion::promotion_type_XX() → shop\Product::is_product_on
|
||||
- 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.
|
||||
|
||||
### Nazewnictwo plikow
|
||||
- Nowe klasy: `NazwaKlasy.php` (bez przedrostka `class.`)
|
||||
- Legacy: `class.NazwaKlasy.php` — zostawiamy do momentu migracji danej klasy
|
||||
- Autoloader obsluguje oba formaty (probuje `class.X.php`, potem `X.php`)
|
||||
- Nowe katalogi z duzej litery: `Views/`, `Controllers/` (legacy: `view/`, `controls/`, `factory/`)
|
||||
|
||||
### Statyczne vs instancyjne metody
|
||||
- **Statyczne** — gdy klasa jest bezstanowa (brak konstruktora, brak properties, brak DI). Czyste funkcje: dane wchodzą, wynik wychodzi. Przykład: klasy VIEW (`front\Views\Languages::render($data)`, `front\view\Banners::banners($data)`)
|
||||
- **Instancyjne** — gdy klasa ma zależności do wstrzyknięcia (repozytoria, serwisy) lub trzyma stan. Przykład: kontrolery z DI (`ShopProductController` z `ProductRepository`, `LanguagesRepository`)
|
||||
|
||||
### Weryfikacja po każdym etapie
|
||||
1. `composer test` (pełny suite PHPUnit)
|
||||
2. Manualne sprawdzenie frontendu: strona główna, kategoria, produkt, koszyk, zamówienie
|
||||
|
||||
Reference in New Issue
Block a user