Example #1
0
 function __construct(Recipe $recipe)
 {
     $this->id = $recipe->getId();
     $this->title = $recipe->getTitle();
     $this->steps = [];
     foreach ($recipe->getSteps() as $step) {
         $this->steps[] = new StepModel($step);
     }
     $this->ingredients = [];
     foreach ($recipe->getIngredients() as $ingredient) {
         $this->ingredients[] = new IngredientModel($ingredient);
     }
 }
Example #2
0
 /**
  * @param Recipe $recipe
  */
 public function clearRecipeSteps(Recipe $recipe)
 {
     foreach ($recipe->getSteps() as $step) {
         $this->stepService->removeStep($step);
     }
     $this->recipeManager->saveChanges();
 }