update ApprModel

This commit is contained in:
Thomas Rubini 2023-01-22 20:57:22 +01:00
parent abb259bbd1
commit e6f735c3af
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -1,16 +1,21 @@
<?php <?php
final class AppreciationsModel { final class ApprModel {
public function getRecipeAppreciations($I_recipe_id){ public function getRecipeApprs($I_recipe_id)
{
$O_model = Model::get(); $O_model = Model::get();
$stmt = $O_model->prepare("SELECT * FROM APPPRECIATION WHERE ID = :recipe_id"); $stmt = $O_model->prepare("SELECT * FROM APPPRECIATION WHERE ID = :recipe_id");
$stmt->bindParam("recipe_id",$I_recipe_id); $stmt->bindParam("recipe_id",$I_recipe_id);
$stmt->execute(); $stmt->execute();
return $stmt->fetch(); return $stmt->fetch();
} }
public function createAppreciation($I_recipe_id,$I_user_id,$S_Comment,$I_score){
public function createAppr($I_recipe_id, $I_user_id, $S_Comment, $I_score)
{
$O_model = Model::get(); $O_model = Model::get();
$stmt = $O_model->prepare("INSERT INTO APPPRECIATION(COMMENT,SCORE,DATE,AUTHOR_ID,RECIPE_ID) VALUES(:comment,:score,:date,:author_id,:recipe_id)"); $stmt = $O_model->prepare("
INSERT INTO APPPRECIATION (COMMENT,SCORE,DATE,AUTHOR_ID,RECIPE_ID) VALUES (:comment, :score, :date, :author_id, :recipe_id)
");
$stmt->bindParam("comment",$S_Comment); $stmt->bindParam("comment",$S_Comment);
$stmt->bindParam("score",$I_score); $stmt->bindParam("score",$I_score);
$_date = date("Y-m-d"); $_date = date("Y-m-d");
@ -20,13 +25,17 @@ final class AppreciationsModel {
$stmt->execute(); $stmt->execute();
return $stmt->fetch(); return $stmt->fetch();
} }
public function deleteAppreciation($I_recipe_id){
public function deleteAppr($I_appr_id)
{
$O_model = Model::get(); $O_model = Model::get();
$stmt = $O_model->prepare("DELETE FROM APPPRECIATION WHERE ID = :recipe_id"); $stmt = $O_model->prepare("DELETE FROM APPPRECIATION WHERE ID = :appr_id");
$stmt->bindParam("recipe_id",$I_recipe_id); $stmt->bindParam("appr_id", $I_appr_id);
$stmt->execute(); $stmt->execute();
} }
public function updateAppreciation($I_recipe_id){
public function updateAppreciation($I_appr_id)
{
} }
} }