コード例 #1
0
 /**
  * @param $ingredientsData
  * @return array
  */
 public function createIngredients($ingredientsData)
 {
     $ingredients = array();
     foreach ($ingredientsData as $entityData) {
         //TODO: If the name is empty skip the adding
         $ingredientEntity = new Ingredient();
         $ingredientEntity->setName($entityData['name']);
         $this->ingredientManager->persistStep($ingredientEntity);
         $ingredients[] = $ingredientEntity;
     }
     $this->ingredientManager->saveChanges();
     return $ingredients;
 }
コード例 #2
0
 /**
  * @param Ingredient $ingredient
  */
 public function __construct(Ingredient $ingredient)
 {
     $this->id = $ingredient->getId();
     $this->name = $ingredient->getName();
 }