ver. 0.287: Scontainers + ShopAttribute frontend migration to Domain

- Scontainers: frontScontainerDetails() with Redis cache in ScontainersRepository
- Scontainers: new front\Views\Scontainers VIEW, deleted factory + view legacy
- ShopAttribute: frontAttributeDetails(), frontValueDetails() with Redis cache in AttributeRepository
- ShopAttribute: clearFrontCache() per attribute/value + language
- ShopAttribute: deleted front\factory\ShopAttribute, updated 4 callers
- Tests: 476 OK, 1512 assertions (+6 frontend tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 08:47:21 +01:00
parent 8162df7356
commit 3b50ba7990
22 changed files with 314 additions and 125 deletions

View File

@@ -213,6 +213,41 @@ class ScontainersRepository
";
}
// ── Frontend methods ──────────────────────────────────────────
public function frontScontainerDetails(int $scontainerId, string $langId): array
{
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = "ScontainersRepository::frontScontainerDetails:$scontainerId";
$objectData = $cacheHandler->get($cacheKey);
if ($objectData) {
$cached = @unserialize($objectData);
if (is_array($cached)) {
return $cached;
}
$cacheHandler->delete($cacheKey);
}
$scontainer = $this->detailsForLanguage($scontainerId, $langId);
if (!is_array($scontainer)) {
$scontainer = [
'id' => $scontainerId,
'status' => 0,
'show_title' => 0,
'languages' => [
'lang_id' => $langId,
'title' => '',
'text' => '',
],
];
}
$cacheHandler->set($cacheKey, $scontainer);
return $scontainer;
}
private function clearFrontCache(int $containerId): void
{
if ($containerId <= 0 || !class_exists('\Shared\Cache\CacheHandler')) {
@@ -220,8 +255,7 @@ class ScontainersRepository
}
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = '\front\factory\Scontainers::scontainer_details:' . $containerId;
$cacheHandler->delete($cacheKey);
$cacheHandler->delete('ScontainersRepository::frontScontainerDetails:' . $containerId);
}
/**