Ejemplo n.º 1
0
 function post_edit_food($f3)
 {
     $meal = $f3->get('meal_orm');
     $id = $f3->get('PARAMS.id');
     $meal->load(array('id=?', $id));
     $meal->copyfrom('POST', function ($val) {
         return array_intersect_key($val, array_flip(array('name', 'info', 'category_id', 'menu_id')));
     });
     if (trim($meal->name) == '') {
         $f3->reroute("/annos/{$id}");
     }
     $data_arr = array();
     $data_arr["id"] = $f3->get('POST.ingredients');
     $data_arr["optional"] = $f3->get('POST.optional');
     Ingredient::add_to_meal($id, $data_arr, $f3);
     $meal->save();
     $menu_id = $f3->get('POST.menu_id');
     AlertControl::message_info("Annosta on muokattu");
     $f3->reroute("/menu/{$menu_id}");
 }