Skip to content

Commit

Permalink
hotfix for category obj
Browse files Browse the repository at this point in the history
  • Loading branch information
jsalisbury committed Feb 28, 2017
1 parent 5a67774 commit a24a3fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/routes/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@
$q = new CategoryQuery;
$cats = $q::create()->find();





$response_json = [
"status" => [
"code" => $response->getStatusCode(),
"message" => "OK"
],
"data" => []
];
foreach( $cats as $cat ) {

foreach( $cats as $cat ) {
$rules = [];
$q = new CategoryRankNutrientQuery;
$requestedCatRules = $q->filterByCategoryId($cat->getId())->orderByRankId()->find();
foreach($requestedCatRules as $rule) {
$rules[$rule->getNutrient()->getName()][] = [
$rules[$rule->getRank()->getName()][] = [
"nutrientName" => $rule->getNutrient()->getName(),
"nutrientId" => $rule->getNutrient()->getId(),
"operator" => $rule->getOperator(),
Expand All @@ -40,9 +37,12 @@
"name" => $cat->getName(),
"rules" => $rules
];

}

$response = $response->withJSON($response_json);
return $response;

});

/**
Expand Down

0 comments on commit a24a3fa

Please sign in to comment.