public function listAreasAction() { try { $areaRep = new \Repository\AreaRepository(); $areas = $areaRep->listAreas(); if (is_null($areas) || count($areas) < 1) { throw new \Exception('No Areas'); } $resource = new \League\Fractal\Resource\Collection($areas, new \Transformer\AreaTransformer()); $this->writeJson($resource); } catch (\Exception $err) { $this->error($err->getMessage()); } }