{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/ContentConfigRepository.php",
"content": "<?php\n\nnamespace Infrastructure\\Persistence;\n\nuse Infrastructure\\Config\\DatabaseFactory;\n\n\/**\n * Repository for content_config table.\n *\n * Handles author profiles, system prompts, and other content configurations.\n *\/\nclass ContentConfigRepository\n{\n private \\PDO $pdo;\n\n public function __construct(?\\PDO $pdo = null)\n {\n $this->pdo = $pdo ?? DatabaseFactory::content();\n }\n\n \/**\n * Find config by ID and type\n *\/\n public function findByIdAndType(int $id, string $type): ?array\n {\n $stmt = $this->pdo->prepare(\n \"SELECT id, name, slug, content, type, status\n FROM content_config\n WHERE id = ? AND type = ? AND status = 'active'\"\n );\n $stmt->execute([$id, $type]);\n $result = $stmt->fetch(\\PDO::FETCH_ASSOC);\n\n return $result !== false ? $result : null;\n }\n\n \/**\n * Find all configs by type\n *\/\n public function findAllByType(string $type): array\n {\n $stmt = $this->pdo->prepare(\n \"SELECT id, name, slug, content, type, status\n FROM content_config\n WHERE type = ? AND status = 'active'\n ORDER BY name\"\n );\n $stmt->execute([$type]);\n\n return $stmt->fetchAll(\\PDO::FETCH_ASSOC);\n }\n\n \/**\n * Get all author profiles\n *\/\n public function getAuthorProfiles(): array\n {\n return $this->findAllByType('author_profile');\n }\n\n \/**\n * Get all system prompts\n *\/\n public function getSystemPrompts(): array\n {\n return $this->findAllByType('system_prompt');\n }\n\n \/**\n * Get author profile by ID\n *\/\n public function getAuthorProfile(int $id): ?array\n {\n return $this->findByIdAndType($id, 'author_profile');\n }\n\n \/**\n * Get system prompt by ID\n *\/\n public function getSystemPrompt(int $id): ?array\n {\n return $this->findByIdAndType($id, 'system_prompt');\n }\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/ContentConfigRepository.php",
"content": "<?php\n\nnamespace Infrastructure\\Persistence;\n\nuse Infrastructure\\Config\\DatabaseFactory;\n\n\/**\n * Repository for content_config table.\n *\n * Handles author profiles, system prompts, and other content configurations.\n *\/\nclass ContentConfigRepository\n{\n private \\PDO $pdo;\n\n public function __construct(?\\PDO $pdo = null)\n {\n $this->pdo = $pdo ?? DatabaseFactory::content();\n }\n\n \/**\n * Find config by ID and type\n *\/\n public function findByIdAndType(int $id, string $type): ?array\n {\n $stmt = $this->pdo->prepare(\n \"SELECT id, name, slug, content, type, status\n FROM content_config\n WHERE id = ? AND type = ? AND status = 'active'\"\n );\n $stmt->execute([$id, $type]);\n $result = $stmt->fetch(\\PDO::FETCH_ASSOC);\n\n return $result !== false ? $result : null;\n }\n\n \/**\n * Find all configs by type\n *\/\n public function findAllByType(string $type): array\n {\n $stmt = $this->pdo->prepare(\n \"SELECT id, name, slug, content, type, status\n FROM content_config\n WHERE type = ? AND status = 'active'\n ORDER BY name\"\n );\n $stmt->execute([$type]);\n\n return $stmt->fetchAll(\\PDO::FETCH_ASSOC);\n }\n\n \/**\n * Get all author profiles\n *\/\n public function getAuthorProfiles(): array\n {\n return $this->findAllByType('author_profile');\n }\n\n \/**\n * Get all system prompts\n *\/\n public function getSystemPrompts(): array\n {\n return $this->findAllByType('system_prompt');\n }\n\n \/**\n * Get author profile by ID\n *\/\n public function getAuthorProfile(int $id): ?array\n {\n return $this->findByIdAndType($id, 'author_profile');\n }\n\n \/**\n * Get system prompt by ID\n *\/\n public function getSystemPrompt(int $id): ?array\n {\n return $this->findByIdAndType($id, 'system_prompt');\n }\n}\n",
"structuredPatch": [],
"originalFile": null
}
}