SuperSeller3000/migrations/Version20260520000000.php
Simon Kuehn ec159d7b3a feat: DB-backed translations editable in admin
- Add Translation entity (locale/domain/key/value, unique on all three)
- Add TranslationRepositoryInterface + DoctrineTranslationRepository
- Add DatabaseTranslator decorator (#[AsDecorator]) that checks DB first
  and falls back to YAML files; clears per-request cache on setLocale()
- Add TranslationCrudController with locale/domain filters and read-only
  key/locale/domain on edit to prevent accidental renames
- Add "Übersetzungen / Translations" menu entry in DashboardController
- Migration 20260520000000: create app.translations table
- Migration 20260520010000: seed from admin.en.yaml + admin.de.yaml (204 rows)
- Flatten admin.de.yaml to dot-notation; add new keys for translation CRUD

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:53:52 +00:00

37 lines
1 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260520000000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create app.translations table for DB-backed i18n';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE TABLE app.translations (
id UUID NOT NULL PRIMARY KEY,
locale VARCHAR(10) NOT NULL,
domain VARCHAR(50) NOT NULL,
translation_key VARCHAR(255) NOT NULL,
value TEXT NOT NULL,
CONSTRAINT uniq_translation UNIQUE (locale, domain, translation_key)
)
SQL);
$this->addSql('CREATE INDEX idx_translations_locale_domain ON app.translations (locale, domain)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE app.translations');
}
}