{
"event": "PreToolUse",
"tool_name": "Grep",
"tool_input": {
"pattern": "public function (store|update|delete)",
"path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/TaxonomyController.php",
"output_mode": "content",
"-B": 2,
"-A": 25
}
}
{
"tool_response": {
"mode": "content",
"numFiles": 0,
"filenames": [],
"content": "40- }\n41-\n42: public function store(): void\n43- {\n44- $this->requireCsrf();\n45-\n46- $word = trim($this->getString('word'));\n47- if ($word === '') {\n48- $_SESSION['error'] = 'Wort darf nicht leer sein.';\n49- $this->redirect('\/semantic-explorer\/stopwords\/new');\n50- }\n51-\n52- try {\n53- $id = $this->repo->create([\n54- 'word' => $word,\n55- 'category' => $this->getString('category') ?: 'generic',\n56- 'reason' => $this->getString('reason') ?: null,\n57- 'is_active' => isset($_POST['is_active']) ? 1 : 0,\n58- ]);\n59-\n60- $_SESSION['success'] = \"Stopword '{$word}' wurde erstellt.\";\n61- $this->redirect('\/semantic-explorer\/stopwords\/' . $id);\n62- } catch (\\PDOException $e) {\n63- if (str_contains($e->getMessage(), 'Duplicate')) {\n64- $_SESSION['error'] = \"Stopword '{$word}' existiert bereits.\";\n65- } else {\n66- $_SESSION['error'] = 'Fehler beim Speichern: ' . $e->getMessage();\n67- }\n--\n83- }\n84-\n85: public function update(string $id): void\n86- {\n87- $this->requireCsrf();\n88-\n89- $stopword = $this->repo->find((int) $id);\n90- if ($stopword === null) {\n91- $this->notFound('Stopword nicht gefunden');\n92- }\n93-\n94- $word = trim($this->getString('word'));\n95- if ($word === '') {\n96- $_SESSION['error'] = 'Wort darf nicht leer sein.';\n97- $this->redirect('\/semantic-explorer\/stopwords\/' . $id);\n98- }\n99-\n100- try {\n101- $this->repo->update((int) $id, [\n102- 'word' => $word,\n103- 'category' => $this->getString('category') ?: 'generic',\n104- 'reason' => $this->getString('reason') ?: null,\n105- 'is_active' => isset($_POST['is_active']) ? 1 : 0,\n106- ]);\n107-\n108- $_SESSION['success'] = 'Stopword wurde aktualisiert.';\n109- $this->redirect('\/semantic-explorer\/stopwords\/' . $id);\n110- } catch (\\PDOException $e) {\n--\n118- }\n119-\n120: public function delete(string $id): void\n121- {\n122- $this->requireCsrf();\n123-\n124- $stopword = $this->repo->find((int) $id);\n125- if ($stopword === null) {\n126- $this->notFound('Stopword nicht gefunden');\n127- }\n128-\n129- $this->repo->delete((int) $id);\n130-\n131- $_SESSION['success'] = \"Stopword '{$stopword['word']}' wurde geloescht.\";\n132- $this->redirect('\/semantic-explorer\/stopwords');\n133- }\n134-\n135: public function toggle(string $id): void\n136- {\n137- $this->requireCsrf();\n138-\n139- $stopword = $this->repo->find((int) $id);\n140- if ($stopword === null) {\n141- $this->notFound('Stopword nicht gefunden');\n142- }\n143-\n144- $this->repo->toggleActive((int) $id);\n145-\n146- $newState = $stopword['is_active'] ? 'deaktiviert' : 'aktiviert';\n147- $_SESSION['success'] = \"Stopword '{$stopword['word']}' wurde {$newState}.\";\n148- $this->redirect('\/semantic-explorer\/stopwords');\n149- }\n150-}",
"numLines": 91
}
}