/** * @Route("/geocode") * @Method({"GET"}) */ public function geocodeAction(Request $request) { $callbackFunction = $request->query->get('jsonp'); $linesStr = $request->query->get('lines'); $geocode = new Geocoder($this->get('doctrine')->getConnection()); if ($linesStr) { $geocode->setLines(LinesUtils::getLinesFromQuery($linesStr)); } $results = $geocode->find($request); return ControllerUtils::jResponse($results, $callbackFunction); }
/** * @Route("/positions") * @Method({"GET"}) */ public function allPositionsAsJsonPAction(Request $request) { $callbackFunction = $request->query->get('jsonp'); $srid = $this->container->getParameter('realtimebus.map.srid'); $positions = new Positions($db = $this->get('doctrine')->getConnection(), $srid); $linesStr = $request->query->get('lines'); if (!is_null($linesStr)) { $positions->setLines(LinesUtils::getLinesFromQuery($linesStr)); } return ControllerUtils::jResponse($positions->positions(), $callbackFunction); }
/** * @Route("/lines") * @Method({"GET"}) */ public function fetchLinesAction(Request $request) { $callbackFunction = $request->query->get('jsonp'); $city = $request->query->get('city'); $timeHorizon = $this->container->getParameter('realtimebus.timetable.time_horizon'); $conn = $this->get('doctrine')->getConnection(); $linesFinder = new LinesFinder($conn); return ControllerUtils::jResponse($linesFinder->getActiveLines($timeHorizon, $city), $callbackFunction); }