Merge pull request #154 from ThomasRubini/recipe_update_delete
This commit is contained in:
commit
6bac400a23
@ -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);
|
header("Location: /recipe/view/".$O_recipe->I_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +53,7 @@ final class IngredientModel
|
|||||||
|
|
||||||
public function delete(){
|
public function delete(){
|
||||||
$O_model = Model::get();
|
$O_model = Model::get();
|
||||||
$stmt = $O_model->prepare("DELETE FROM INGREDIENT WHERE ID=:id");
|
|
||||||
$stmt->bindParam("id", $this->I_INGREDIENT_ID);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt = $O_model->prepare("DELETE FROM RECIPE_INGREDIENT WHERE INGREDIENT_ID=:id");
|
$stmt = $O_model->prepare("DELETE FROM RECIPE_INGREDIENT WHERE INGREDIENT_ID=:id");
|
||||||
$stmt->execute();
|
|
||||||
$stmt->bindParam("id", $this->I_INGREDIENT_ID);
|
$stmt->bindParam("id", $this->I_INGREDIENT_ID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user