diff options
Diffstat (limited to 'src/controller')
-rw-r--r-- | src/controller/HeadFootController.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/controller/HeadFootController.php b/src/controller/HeadFootController.php new file mode 100644 index 0000000..c7a9cec --- /dev/null +++ b/src/controller/HeadFootController.php | |||
@@ -0,0 +1,33 @@ | |||
1 | <?php | ||
2 | // src/controller/HeadFootController.php | ||
3 | |||
4 | declare(strict_types=1); | ||
5 | |||
6 | //use App\Entity\Node; | ||
7 | //use App\Entity\NodeData; | ||
8 | //use App\Entity\Image; | ||
9 | //use Doctrine\Common\Collections\ArrayCollection; | ||
10 | use Doctrine\ORM\EntityManager; | ||
11 | |||
12 | class HeadFootController | ||
13 | { | ||
14 | static public function setTextData(EntityManager $entityManager, array $request_params, array $json): void | ||
15 | { | ||
16 | if(count($request_params) !== 2){ | ||
17 | echo json_encode(['success' => false]); | ||
18 | die; | ||
19 | } | ||
20 | |||
21 | $model = new Model($entityManager); | ||
22 | if($model->findWhateverNode('name_node', $request_params[0])){ | ||
23 | $node_data = $model->getNode()->getNodeData(); | ||
24 | $node_data->updateData($request_params[1], htmlspecialchars($json['new_text'])); // $request_params[1] n'est pas contrôlé | ||
25 | $entityManager->flush(); | ||
26 | echo json_encode(['success' => true]); | ||
27 | } | ||
28 | else{ | ||
29 | echo json_encode(['success' => false]); | ||
30 | } | ||
31 | die; | ||
32 | } | ||
33 | } \ No newline at end of file | ||