From 627b3da748a7be7f478fbca419fe86a446184cc1 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Sun, 5 May 2024 07:14:26 +0800 Subject: [PATCH] Disallow editing of IDs of static content #799 --- src/Controller/StaticContentController.php | 10 +--------- templates/static-content/form.html.twig | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Controller/StaticContentController.php b/src/Controller/StaticContentController.php index 44c77595..95b9c8bd 100644 --- a/src/Controller/StaticContentController.php +++ b/src/Controller/StaticContentController.php @@ -212,8 +212,7 @@ class StaticContentController extends Controller throw $this->createNotFoundException('The item does not exist'); // set and save values - $row->setID($req->request->get('id')) - ->setContent($req->request->get('content')); + $row->setContent($req->request->get('content')); // validate $errors = $validator->validate($row); @@ -221,13 +220,6 @@ class StaticContentController extends Controller // initialize error list $error_array = []; - // check for duplicate ID - $result = $em->getRepository(StaticContent::class)->find($id); - if ($result != null) - { - $error_array['id'] = 'Duplicate ID exists.'; - } - // add errors to list foreach ($errors as $error) { $error_array[$error->getPropertyPath()] = $error->getMessage(); diff --git a/templates/static-content/form.html.twig b/templates/static-content/form.html.twig index 3f078773..0a1f4f0d 100644 --- a/templates/static-content/form.html.twig +++ b/templates/static-content/form.html.twig @@ -39,7 +39,7 @@ - +