Skip to content

Commit

Permalink
savebatch prep work 4
Browse files Browse the repository at this point in the history
  • Loading branch information
jsalisbury committed Apr 4, 2017
1 parent 4fcf72d commit d7b5c1f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions api/routes/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@

$app->post('/rules/saveBatch/{catId}', function($request, $response) {

$theRules = json_decode($request->getBody());
$cat = $request->getAttribute('catId');
foreach ($theRules as $r):
$rule = new CategoryRankNutrient;
$rule->findPk($r['ruleId'];
$rule->setThreshold($r['threshold']);
$rule->setUnits($r['units']));
$rule->setOperator($r['operator']);
$rule->setCategoryId($cat);
$rule->setRankId($r['rankId']);
$rule->setNutrientId($r['nutrientId']);
$rule->save();
endforeach;
// $theRules = json_decode($request->getBody());
// $cat = $request->getAttribute('catId');
// foreach ($theRules as $r):
// $rule = new CategoryRankNutrient;
// $rule->findPk($r['ruleId'];
// $rule->setThreshold($r['threshold']);
// $rule->setUnits($r['units']));
// $rule->setOperator($r['operator']);
// $rule->setCategoryId($cat);
// $rule->setRankId($r['rankId']);
// $rule->setNutrientId($r['nutrientId']);
// $rule->save();
// endforeach;

});

0 comments on commit d7b5c1f

Please sign in to comment.