/** @param string[] $data */ public function SetData($data) { if (isset($data['baseIngredientID'])) { if ($data['baseIngredientID']) { $baseIngredient = $this->Session->IngredientByID($data['baseIngredientID']); if (!$baseIngredient) { APIResponse(RESPONSE_400, "Update Ingredient with bad base ingredient ID."); } else { $this->BaseIngredient = $baseIngredient; } } else { $this->BaseIngredient = false; } } if (isset($data['id'])) { $this->ID = (int) $data['id']; } if (isset($data['title'])) { $this->Title = $data['title']; } if (isset($data['type'])) { $this->Type = $data['type']; } if (isset($data['description'])) { $this->Description = $data['description']; } }