make getFullRecipeWithApprs return apprs
This commit is contained in:
parent
ae99e8e0c2
commit
4dcb58ee16
@ -1,13 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class ApprModel {
|
final class ApprModel {
|
||||||
public function getRecipeApprs($I_recipe_id)
|
|
||||||
|
public function searchRecipeApprs($I_recipe_id)
|
||||||
{
|
{
|
||||||
$O_model = Model::get();
|
$O_model = Model::get();
|
||||||
$stmt = $O_model->prepare("SELECT * FROM APPRECIATION WHERE ID = :recipe_id");
|
$stmt = $O_model->prepare("SELECT * FROM APPRECIATION WHERE RECIPE_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->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createAppr($I_user_id, $I_recipe_id, $S_Comment, $I_score)
|
public function createAppr($I_user_id, $I_recipe_id, $S_Comment, $I_score)
|
||||||
|
@ -15,7 +15,7 @@ final class RecipeModel
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFullRecipeWithApprs($I_id)
|
public function getFullRecipe($I_id)
|
||||||
{
|
{
|
||||||
$A_recipe = self::getRecipeByID($I_id);
|
$A_recipe = self::getRecipeByID($I_id);
|
||||||
if ($A_recipe === null)return null;
|
if ($A_recipe === null)return null;
|
||||||
@ -34,6 +34,17 @@ final class RecipeModel
|
|||||||
return $A_recipe;
|
return $A_recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFullRecipeWithApprs($I_id)
|
||||||
|
{
|
||||||
|
$A_recipe = self::getFullRecipe($I_id);
|
||||||
|
|
||||||
|
$O_apprModel = new ApprModel();
|
||||||
|
|
||||||
|
$A_recipe["APPRS"] = $O_apprModel->searchRecipeApprs($I_id);
|
||||||
|
|
||||||
|
return $A_recipe;
|
||||||
|
}
|
||||||
|
|
||||||
public function searchRecipesByName($S_query)
|
public function searchRecipesByName($S_query)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user