From 46ee3fbfb1afa8070155c8fae528d3377cff2c59 Mon Sep 17 00:00:00 2001 From: Djyp Date: Sun, 3 Mar 2019 21:22:25 +0100 Subject: [PATCH] Defining and documenting the Recipe class --- doc/Models.md | 125 ++++++++++++++++++++++++++++++++++++++++++ src/Entity/Recipe.php | 61 +++++++++++++++++++-- 2 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 doc/Models.md diff --git a/doc/Models.md b/doc/Models.md new file mode 100644 index 0000000..991395c --- /dev/null +++ b/doc/Models.md @@ -0,0 +1,125 @@ +# Models specifications + +## Recipe + +### estimatedTime +Array of different estimated times : cookTime, prepTime, performTime, totalTime, waitTime + +cookTime + - https://schema.org/Duration + - The time it takes to actually cook the dish +prepTime + - https://schema.org/Duration + - The length of time it takes to prepare the items to be used in instructions or a direction +performTime + - https://schema.org/Duration + - The length of time it takes to perform instructions or a direction (not including time to prepare the supplies) +totalTime + - https://schema.org/Duration + - The total time required to perform instructions or a direction (including time to prepare the supplies) +waitTime + - https://schema.org/Duration + - The total time needed to wait between steps, in ISO 8601 duration format. + - waitTime is not in the schema... for now ! https://github.com/schemaorg/schemaorg/issues/2164 + +### cookingMethod +The method of cooking, such as Frying, Steaming,... +TODO +Maybe have a checklist of methods ? +Maybe just not use it + +### recipeCategory +The category of the recipe—for example, appetizer, entree, etc. + +### recipeCuisine +The cuisine of the recipe (for example, French or Ethiopian). + +### recipeIngredient +A single ingredient used in the recipe, e.g. sugar, flour or garlic. +An array of ingredients in text format + +### recipeInstructions +A step in making the recipe, in the form of a single item (document, video, etc.) or an ordered list with HowToStep and/or HowToSection items. +An array steps in text format. +The number of the step should never be the text. + +### recipeYield +The quantity produced by the recipe (for example, number of people served, number of servings, etc). + +### suitableForDiet +Indicates a dietary restriction or guideline for which this recipe or menu item is suitable, e.g. diabetic, halal etc. +DiabeticDiet +GlutenFreeDiet +HalalDiet +HinduDiet +KosherDiet +LowCalorieDiet +LowFatDiet +LowLactoseDiet +LowSaltDiet +VeganDiet +VegetarianDiet +TODO : Define how to show in the views + +Array of... texts ? + +--- + +### estimatedCost ? + +### tool + +### about ? +Probablement la description... ou peut-être le titre + +### aggregateRating ? + +### author +The author, a user +TODO : define a user + +### comment +A list of comments +TODO : define a comment + +### commentCount +A property to be shown in microdata/json-ld but in the model + +### contributor +If anyone contribute to the recipe they should appear here as a list of users + +### dateModified +The most recent modification date + +### datePublished +The date the first time the recipe appeared online + +### dicussionUrl ? +PROBABLY NOT + +### licence + +### text ? + +### thumbnailUrl ? + +### version ? + +### description + +### identifier ? + +### image + +### mainEntityOfPage ? + +### name +The name of the recipe + +### url ? + +### likesCount +Calculated from the likes in the database + +### difficulty +The degree of difficulty from a list to define diff --git a/src/Entity/Recipe.php b/src/Entity/Recipe.php index 0a21200..6e5942e 100644 --- a/src/Entity/Recipe.php +++ b/src/Entity/Recipe.php @@ -19,7 +19,7 @@ class Recipe /** * @ORM\Column(type="string", length=20, nullable=true) */ - private $cookTime; + private $estimatedTime; /** * @ORM\Column(type="string", length=100, nullable=true) @@ -41,19 +41,34 @@ class Recipe */ private $recipeIngredient; + /** + * @ORM\Column(type="text") + */ + private $recipeInstructions; + + /** + * @ORM\Column(type="string", length=25) + */ + private $recipeYield; + + /** + * @ORM\Column(type="string", length=255, nullable=true) + */ + private $suitableForDiet; + public function getId(): ?int { return $this->id; } - public function getCookTime(): ?string + public function getEstimatedTime(): ?string { - return $this->cookTime; + return $this->estimatedTime; } - public function setCookTime(?string $cookTime): self + public function setEstimatedTime(?string $estimatedTime): self { - $this->cookTime = $cookTime; + $this->estimatedTime = $estimatedTime; return $this; } @@ -105,4 +120,40 @@ class Recipe return $this; } + + public function getRecipeInstructions(): ?string + { + return $this->recipeInstructions; + } + + public function setRecipeInstructions(string $recipeInstructions): self + { + $this->recipeInstructions = $recipeInstructions; + + return $this; + } + + public function getRecipeYield(): ?string + { + return $this->recipeYield; + } + + public function setRecipeYield(?string $recipeYield): self + { + $this->recipeYield = $recipeYield; + + return $this; + } + + public function getSuitableForDiet(): ?string + { + return $this->suitableForDiet; + } + + public function setSuitableForDiet(?string $suitableForDiet): self + { + $this->suitableForDiet = $suitableForDiet; + + return $this; + } }