Merge pull request #118 from ThomasRubini/recipe_preload
This commit is contained in:
commit
81dbc8a68c
@ -10,7 +10,7 @@ final class RecipeController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO MAKE THE VIEW USE THE NEW DATA FORMAT
|
//TODO MAKE THE VIEW USE THE NEW DATA FORMAT
|
||||||
$O_recipe = RecipeModel::getFullRecipeWithApprs($A_urlParams[0]);
|
$O_recipe = RecipeModel::getByID($A_urlParams[0]);
|
||||||
if ($O_recipe === null) {
|
if ($O_recipe === null) {
|
||||||
throw new HTTPSpecialCaseException(404);
|
throw new HTTPSpecialCaseException(404);
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ final class RecipeController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$O_recipe = RecipeModel::getFullRecipeById($A_urlParams[0]);
|
$O_recipe = RecipeModel::getByID($A_urlParams[0]);
|
||||||
if ($O_recipe === null) {
|
if ($O_recipe === null) {
|
||||||
throw new HTTPSpecialCaseException(404);
|
throw new HTTPSpecialCaseException(404);
|
||||||
}
|
}
|
||||||
|
@ -147,30 +147,6 @@ final class RecipeModel
|
|||||||
return $this->A_APPRS;
|
return $this->A_APPRS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFullRecipe()
|
|
||||||
{
|
|
||||||
$this->getAuthor();
|
|
||||||
$this->getDifficulty();
|
|
||||||
$this->getIngredients();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getFullRecipeById($I_id)
|
|
||||||
{
|
|
||||||
$O_recipe = self::getByID($I_id);
|
|
||||||
$O_recipe->getFullRecipe();
|
|
||||||
return $O_recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getFullRecipeWithApprs($I_id)
|
|
||||||
{
|
|
||||||
$O_recipe = self::getFullRecipeById($I_id);
|
|
||||||
if ($O_recipe === null)return null;
|
|
||||||
|
|
||||||
$O_recipe->getApprs();
|
|
||||||
|
|
||||||
return $O_recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: return array object
|
//TODO: return array object
|
||||||
public static function searchRecipesByName($S_query)
|
public static function searchRecipesByName($S_query)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ $O_recipe = $A_view["RECIPE"];
|
|||||||
<section class="infosRecette">
|
<section class="infosRecette">
|
||||||
<header>
|
<header>
|
||||||
<h1><?= $O_recipe->S_NAME ?></h1>
|
<h1><?= $O_recipe->S_NAME ?></h1>
|
||||||
<p><?= $O_recipe->I_TIME ?> — <?= $O_recipe->O_DIFFICULTY->S_NAME ?></p>
|
<p><?= $O_recipe->I_TIME ?> — <?= $O_recipe->getDifficulty()->S_NAME ?></p>
|
||||||
</header>
|
</header>
|
||||||
<p><?= $O_recipe->S_DESCR ?></p>
|
<p><?= $O_recipe->S_DESCR ?></p>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user