From 2a54dd319268a6d5bd5b7dba9603486999178af5 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 26 Jan 2023 21:35:54 +0100 Subject: [PATCH] add comments --- Controllers/RecipeController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php index b1437a8..0bd9a4b 100644 --- a/Controllers/RecipeController.php +++ b/Controllers/RecipeController.php @@ -79,14 +79,18 @@ final class RecipeController Session::login_or_die(); $O_recipe = RecipeModel::createEmpty(); + + // fill basic recipe attribtues self::fillRecipeFromPostParams($O_recipe, $A_postParams); $O_recipe->insert(); + // update img if necessary $fp = Utils::tryProcessImg("recipeImage"); if($fp !== null) { $O_recipe->updateImg($fp); } + // handle ingredients $A_ingredientNames = Utils::getOrDie($A_postParams, "recipeIngredientNames"); $A_ingredientQuantities = Utils::getOrDie($A_postParams, "recipeIngredientQuantities"); @@ -120,14 +124,17 @@ final class RecipeController } } + // fill basic recipe attribtues self::fillRecipeFromPostParams($O_recipe, $A_postParams); $O_recipe->update(); - + + // update img if necessary $fp = Utils::tryProcessImg("recipeImage"); if($fp !== null) { $O_recipe->updateImg($fp); } - + + // handle ingredients $A_ingredientNames = Utils::getOrDie($A_postParams, "recipeIngredientNames"); $A_ingredientQuantities = Utils::getOrDie($A_postParams, "recipeIngredientQuantities");