{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ProtokollController.php",
"old_string": "class ProtokollController extends Controller\n{\n private ViewProtokollUseCase $protokollUseCase;\n\n public function __construct(?ViewProtokollUseCase $protokollUseCase = null)\n {\n $this->protokollUseCase = $protokollUseCase ?? new ViewProtokollUseCase();\n }\n\n public function index(): void\n {\n $pagination = Pagination::fromRequest(50);",
"new_string": "class ProtokollController extends Controller\n{\n private ViewProtokollUseCase $protokollUseCase;\n\n public function __construct(ViewProtokollUseCase $protokollUseCase)\n {\n $this->protokollUseCase = $protokollUseCase;\n }\n\n public function index(): void\n {\n $pagination = $this->getPagination(50);"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ProtokollController.php",
"oldString": "class ProtokollController extends Controller\n{\n private ViewProtokollUseCase $protokollUseCase;\n\n public function __construct(?ViewProtokollUseCase $protokollUseCase = null)\n {\n $this->protokollUseCase = $protokollUseCase ?? new ViewProtokollUseCase();\n }\n\n public function index(): void\n {\n $pagination = Pagination::fromRequest(50);",
"newString": "class ProtokollController extends Controller\n{\n private ViewProtokollUseCase $protokollUseCase;\n\n public function __construct(ViewProtokollUseCase $protokollUseCase)\n {\n $this->protokollUseCase = $protokollUseCase;\n }\n\n public function index(): void\n {\n $pagination = $this->getPagination(50);",
"originalFile": "<?php\n\nnamespace Controller;\n\nuse Domain\\ValueObject\\Pagination;\nuse Framework\\Controller;\nuse UseCases\\Protokoll\\ViewProtokollUseCase;\n\nclass ProtokollController extends Controller\n{\n private ViewProtokollUseCase $protokollUseCase;\n\n public function __construct(?ViewProtokollUseCase $protokollUseCase = null)\n {\n $this->protokollUseCase = $protokollUseCase ?? new ViewProtokollUseCase();\n }\n\n public function index(): void\n {\n $pagination = Pagination::fromRequest(50);\n\n $search = $this->getString('search');\n $status = $this->getString('status');\n $model = $this->getString('model');\n\n $searchVal = $search !== '' ? $search : null;\n $statusVal = $status !== '' ? $status : null;\n $modelVal = $model !== '' ? $model : null;\n\n $result = $this->protokollUseCase->getPaginated($searchVal, $statusVal, $modelVal, $pagination);\n $updatedPagination = $result['pagination'];\n\n $this->view('protokoll.index', [\n 'title' => 'KI-Protokoll',\n 'stats' => $this->protokollUseCase->getStatistics(),\n 'entries' => array_map(fn ($dto) => $dto->toArray(), $result['entries']),\n 'models' => $this->protokollUseCase->getDistinctModels(),\n 'currentSearch' => $search,\n 'currentStatus' => $status,\n 'currentModel' => $model,\n 'currentPage' => $updatedPagination->page,\n 'totalCount' => $updatedPagination->totalCount,\n 'totalPages' => $updatedPagination->totalPages(),\n ]);\n }\n\n public function show(string $id): void\n {\n $entry = $this->protokollUseCase->getById((int) $id);\n if ($entry === null) {\n $this->notFound('Protokoll-Eintrag nicht gefunden');\n }\n\n $nav = $this->protokollUseCase->getNavigation((int) $id);\n\n $this->view('protokoll.show', [\n 'title' => 'Protokoll #' . $id,\n 'entry' => $entry->toArray(),\n 'prevEntry' => $nav['prevId'] !== null ? ['id' => $nav['prevId']] : false,\n 'nextEntry' => $nav['nextId'] !== null ? ['id' => $nav['nextId']] : false,\n ]);\n }\n}\n",
"structuredPatch": [
{
"oldStart": 10,
"oldLines": 14,
"newStart": 10,
"newLines": 14,
"lines": [
" {",
" private ViewProtokollUseCase $protokollUseCase;",
" ",
"- public function __construct(?ViewProtokollUseCase $protokollUseCase = null)",
"+ public function __construct(ViewProtokollUseCase $protokollUseCase)",
" {",
"- $this->protokollUseCase = $protokollUseCase ?? new ViewProtokollUseCase();",
"+ $this->protokollUseCase = $protokollUseCase;",
" }",
" ",
" public function index(): void",
" {",
"- $pagination = Pagination::fromRequest(50);",
"+ $pagination = $this->getPagination(50);",
" ",
" $search = $this->getString('search');",
" $status = $this->getString('status');"
]
}
],
"userModified": false,
"replaceAll": false
}
}