public function postInfoJson($slug, Request $request, Application $app) { if (!$this->build($slug, $request, $app)) { $app->abort(404, "Does not exist."); } $ourRequest = new \Request($request); $edits = false; if ($ourRequest->hasGetOrPost('title') && $this->venue->setTitleIfDifferent($ourRequest->getGetOrPostString('title', ''))) { $edits = true; } if ($ourRequest->hasGetOrPost('description') && $this->venue->setDescriptionIfDifferent($ourRequest->getGetOrPostString('description', ''))) { $edits = true; } if ($ourRequest->hasGetOrPost('address') && $this->venue->setAddressIfDifferent($ourRequest->getGetOrPostString('address', ''))) { $edits = true; } if ($ourRequest->hasGetOrPost('address_code') && $this->venue->setAddressCodeIfdifferent($ourRequest->getGetOrPostString('address_code', ''))) { $edits = true; } if ($ourRequest->hasGetOrPost('lat') && $ourRequest->hasGetOrPost('lng')) { if ($this->venue->setLatIfDifferent($ourRequest->getGetOrPostString('lat', ''))) { $edits = true; } if ($this->venue->setLngIfDifferent($ourRequest->getGetOrPostString('lng', ''))) { $edits = true; } } if ($edits) { $repo = new VenueRepository(); $repo->edit($this->venue, $app['apiUser']); $out = array('edited' => true); } else { $out = array('edited' => false); } return json_encode($out); }