From 0fd3e0aa15b8a60fad5e10f45819eb41810e799a Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 26 Jan 2023 21:41:58 +0100 Subject: [PATCH] delete ingredients not in update request --- Controllers/RecipeController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php index 0bd9a4b..521e1b7 100644 --- a/Controllers/RecipeController.php +++ b/Controllers/RecipeController.php @@ -169,6 +169,11 @@ final class RecipeController } } + // delete all remaining ingredients, they have been deleted by the user + foreach($A_ingrsInDB as $O_ingr){ + $O_ingr->delete(); + } + header("Location: /recipe/view/".$O_recipe->I_ID); }