Esempio n. 1
0
 public static function delete_unused()
 {
     $query = DB::connection()->prepare("SELECT * FROM Ingredient");
     $query->execute();
     $rows = $query->fetchAll();
     foreach ($rows as $row) {
         $ingredient = new Ingredient(array('ingredient_id' => $row['id'], 'name' => $row['name']));
         if (is_null($ingredient->find_recipes_for_ingredient())) {
             $ingredient->delete();
         }
     }
 }