public static function listDrinkIngredients($drink_id)
 {
     $query = DB::connection()->prepare('SELECT * FROM DrinkIngredient WHERE drink_id = :drink_id');
     $query->execute(array($drink_id));
     $rows = $query->fetchAll(PDO::FETCH_OBJ);
     $ingredients = array();
     foreach ($rows as $row) {
         $ingredient = new DrinkIngredient();
         $ingredient->setAmount($row->amount);
         $ingredient->setUnit($row->unit);
         $ingredient->setIngredient_id($row->ingredient_id);
         $ingredient->setDrink_id($row->drink_id);
         $ingredient->setIngredientName($row->ingredient_id);
         $ingredients[] = $ingredient;
     }
     return $ingredients;
 }
 public static function validateNameErrors($errors, $id)
 {
     if (count($errors) > 0) {
         $drink = Drink::findOne($id);
         $drink_types = DrinkType::listDrinkTypes();
         $drink_ingredients = DrinkIngredient::listDrinkIngredients($id);
         View::make('drink/edit.html', array('attributes' => $drink, 'drink_types' => $drink_types, 'drink_ingredients' => $drink_ingredients, 'message' => $errors[0]));
     }
 }