{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/CollectionRepository.php",
"offset": 195,
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/CollectionRepository.php",
"content": " * Check if collection is referenced by sessions, orders, or preferences.\n *\n * @return array{has_references: bool, references: array<int, array{type: string, count: int}>}\n *\/\n public function checkReferences(string $collectionId): array\n {\n $references = [];\n $jsonValue = json_encode($collectionId);\n\n \/\/ Check chat_sessions (ki_content)\n try {\n $pdo = DatabaseFactory::content();\n $stmt = $pdo->prepare(\"\n SELECT COUNT(*) FROM chat_sessions\n WHERE JSON_CONTAINS(collections, ?, '$')\n \");\n $stmt->execute([$jsonValue]);\n $count = (int) $stmt->fetchColumn();\n if ($count > 0) {\n $references[] = ['type' => 'chat_sessions', 'count' => $count];\n }\n\n \/\/ Check content_orders (ki_content)\n $stmt = $pdo->prepare(\"\n SELECT COUNT(*) FROM content_orders\n WHERE JSON_CONTAINS(collections, ?, '$')\n \");\n $stmt->execute([$jsonValue]);\n $count = (int) $stmt->fetchColumn();\n if ($count > 0) {\n $references[] = ['type' => 'content_orders', 'count' => $count];\n }\n } catch (\\PDOException $e) {\n \/\/ Tables might not exist yet\n }\n\n return [\n 'has_references' => count($references) > 0,\n 'references' => $references,\n ];\n }\n}\n",
"numLines": 43,
"startLine": 195,
"totalLines": 237
}
}
}