make functions to get links

This commit is contained in:
Thomas Rubini 2023-01-25 15:47:09 +01:00
parent f9de8858cf
commit 9f3b566575
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -81,6 +81,14 @@ final class RecipeModel
return self::createFromRow($row, $I_id);
}
public function getImageLink(){
return '/static/img/recipes/'.$this->I_ID;
}
public function getLink(){
return '/recipe/view/'.$this->I_ID;
}
public function getImage(){
$O_model = Model::get();
$stmt = $O_model->prepare("SELECT IMG FROM RECIPE WHERE ID=:id");
@ -162,9 +170,7 @@ final class RecipeModel
)
-- get a row per occurrence and sort by occurrences number
select RECIPE.*,
CONCAT('/recipe/view/', RECIPE.ID) AS RECIPE_LINK,
CONCAT('/static/img/recipes/', RECIPE.ID) AS IMG_LINK,
select RECIPE.*
1 AS NOTE
from CTE
JOIN RECIPE