예제 #1
0
 function post_edit_ingredient($f3)
 {
     $ing = $f3->get('ingredient_orm');
     $id = $f3->get('PARAMS.id');
     $allergies = $f3->get('POST.allergies');
     $ing->load(array('id=?', $id));
     $ing->copyfrom('POST', function ($val) {
         return array_intersect_key($val, array_flip(array('name', 'info', 'other_allergies', 'producer')));
     });
     if (trim($ing->name) == '') {
         $f3->reroute("/ainesosa/{$id}");
     }
     Allergy::add_allergies($f3, $id, $allergies);
     AlertControl::message_info("Ainesosaa on muokattu");
     $ing->save();
     $f3->reroute("/ainesosa/listaa");
 }