{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/TaskCommentRepository.php",
"old_string": "namespace Infrastructure\\Persistence;\n\n\/\/ @responsibility: Persistenz für Task-Kommentare\n\nuse Domain\\Entity\\TaskComment;\n\nclass TaskCommentRepository",
"new_string": "namespace Infrastructure\\Persistence;\n\n\/\/ @responsibility: Persistenz für Task-Kommentare\n\nuse Domain\\Entity\\TaskComment;\nuse Domain\\Repository\\TaskCommentRepositoryInterface;\n\nclass TaskCommentRepository implements TaskCommentRepositoryInterface"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Persistence\/TaskCommentRepository.php",
"oldString": "namespace Infrastructure\\Persistence;\n\n\/\/ @responsibility: Persistenz für Task-Kommentare\n\nuse Domain\\Entity\\TaskComment;\n\nclass TaskCommentRepository",
"newString": "namespace Infrastructure\\Persistence;\n\n\/\/ @responsibility: Persistenz für Task-Kommentare\n\nuse Domain\\Entity\\TaskComment;\nuse Domain\\Repository\\TaskCommentRepositoryInterface;\n\nclass TaskCommentRepository implements TaskCommentRepositoryInterface",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Persistence;\n\n\/\/ @responsibility: Persistenz für Task-Kommentare\n\nuse Domain\\Entity\\TaskComment;\n\nclass TaskCommentRepository\n{\n private \\PDO $pdo;\n\n public function __construct(\\PDO $pdo)\n {\n $this->pdo = $pdo;\n }\n\n public function find(int $id): ?TaskComment\n {\n $stmt = $this->pdo->prepare('SELECT * FROM task_comments WHERE id = :id');\n $stmt->execute(['id' => $id]);\n $row = $stmt->fetch();\n\n return $row !== false ? TaskComment::fromArray($row) : null;\n }\n\n public function findByTaskId(int $taskId, int $limit = 50): array\n {\n $stmt = $this->pdo->prepare(\n 'SELECT * FROM task_comments WHERE task_id = :task_id ORDER BY created_at DESC LIMIT :limit'\n );\n $stmt->bindValue(':task_id', $taskId, \\PDO::PARAM_INT);\n $stmt->bindValue(':limit', $limit, \\PDO::PARAM_INT);\n $stmt->execute();\n\n $comments = [];\n while ($row = $stmt->fetch()) {\n $comments[] = TaskComment::fromArray($row);\n }\n\n return $comments;\n }\n\n public function findByType(int $taskId, string $commentType): array\n {\n $stmt = $this->pdo->prepare(\n 'SELECT * FROM task_comments WHERE task_id = :task_id AND comment_type = :type ORDER BY created_at DESC'\n );\n $stmt->execute(['task_id' => $taskId, 'type' => $commentType]);\n\n $comments = [];\n while ($row = $stmt->fetch()) {\n $comments[] = TaskComment::fromArray($row);\n }\n\n return $comments;\n }\n\n public function save(TaskComment $comment): int\n {\n $sql = 'INSERT INTO task_comments (\n task_id, author, author_type, comment_type,\n content, metadata, created_at\n ) VALUES (\n :task_id, :author, :author_type, :comment_type,\n :content, :metadata, :created_at\n )';\n\n $stmt = $this->pdo->prepare($sql);\n $data = $comment->toArray();\n\n $stmt->execute([\n 'task_id' => $data['task_id'],\n 'author' => $data['author'],\n 'author_type' => $data['author_type'],\n 'comment_type' => $data['comment_type'],\n 'content' => $data['content'],\n 'metadata' => json_encode($data['metadata']),\n 'created_at' => $data['created_at'],\n ]);\n\n return (int) $this->pdo->lastInsertId();\n }\n\n public function delete(int $id): bool\n {\n $stmt = $this->pdo->prepare('DELETE FROM task_comments WHERE id = :id');\n\n return $stmt->execute(['id' => $id]);\n }\n}\n",
"structuredPatch": [
{
"oldStart": 7,
"oldLines": 8,
"newStart": 7,
"newLines": 9,
"lines": [
" \/\/ @responsibility: Persistenz für Task-Kommentare",
" ",
" use Domain\\Entity\\TaskComment;",
"+use Domain\\Repository\\TaskCommentRepositoryInterface;",
" ",
"-class TaskCommentRepository",
"+class TaskCommentRepository implements TaskCommentRepositoryInterface",
" {",
" private \\PDO $pdo;",
" "
]
}
],
"userModified": false,
"replaceAll": false
}
}