ver. 0.292: ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration to Domain

Full migration of front\factory\ — entire directory removed (all 20 classes migrated).
ProductRepository +20 frontend methods, PromotionRepository +5 applyType methods,
TransportRepository +4 cached methods, PaymentMethodRepository +cached frontend methods.
Fix: broken transports_list() in ajax.php replaced with forPaymentMethod().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 21:55:16 +01:00
parent 827b903e1e
commit 89d9e61bec
48 changed files with 1780 additions and 975 deletions

View File

@@ -257,6 +257,67 @@ class PaymentMethodRepository
return $result;
}
/**
* Metody platnosci dla danego transportu — z Redis cache (frontend).
*
* @return array<int, array<string, mixed>>
*/
public function paymentMethodsByTransport(int $transportMethodId): array
{
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_methods_by_transport' . $transportMethodId;
$cached = $cacheHandler->get($cacheKey);
if ($cached) {
return unserialize($cached);
}
$result = $this->forTransport($transportMethodId);
$cacheHandler->set($cacheKey, $result);
return $result;
}
/**
* Pojedyncza aktywna metoda platnosci — z Redis cache (frontend).
*/
public function paymentMethodCached(int $paymentMethodId): ?array
{
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_method' . $paymentMethodId;
$cached = $cacheHandler->get($cacheKey);
if ($cached) {
return unserialize($cached);
}
$result = $this->findActiveById($paymentMethodId);
$cacheHandler->set($cacheKey, $result);
return $result;
}
/**
* Wszystkie aktywne metody platnosci — z Redis cache (frontend).
*
* @return array<int, array<string, mixed>>
*/
public function paymentMethodsCached(): array
{
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_methods';
$cached = $cacheHandler->get($cacheKey);
if ($cached) {
return unserialize($cached);
}
$result = $this->allActive();
$cacheHandler->set($cacheKey, $result);
return $result;
}
private function normalizePaymentMethod(array $row): array
{
$row['id'] = (int)($row['id'] ?? 0);