public function read()
 {
     if ($code = $this->getApiParameter('cityOrCityPartnameByCode', FALSE)) {
         $this->sendJson($this->apiStreetsService->getCityOrPartCityNameByCode($code));
     } elseif ($code = $this->getApiParameter('code', FALSE)) {
         $this->sendJson($this->apiStreetsService->getCityParts(['code' => $code]));
     } else {
         $title = trim($this->getApiParameter('title', FALSE));
         $limit = $this->getApiParameter('limit', FALSE);
         $this->sendJson($this->apiStreetsService->getCityParts(['title' => $title, 'limit' => $limit]));
     }
 }
Пример #2
0
 public function read()
 {
     $title = $this->getApiParameter('title', FALSE);
     if ($partCityId = $this->getApiParameter('partCityId', FALSE)) {
         $this->sendJson($this->apiStreetsService->getStreetsFromPartCity($partCityId, $title));
     } elseif ($cityId = $this->getApiParameter('cityId', FALSE)) {
         $this->sendJson($this->apiStreetsService->getStreetsFromCity($cityId, $title, $this->getApiParameter('includePartCities', FALSE)));
     } elseif ($code = $this->getApiParameter('code', FALSE)) {
         $this->sendJson($this->apiStreetsService->getStreetsFromCityOrPartCityByCode($code, $title));
     } else {
         $this->sendJson(['error' => 'Missing one of partCityId or cityId parameter.']);
     }
 }
Пример #3
0
 public function read()
 {
     $title = $this->getApiParameter('title', FALSE);
     $limit = $this->getApiParameter('limit', FALSE);
     $this->sendJson($this->apiStreetsService->getCities($title));
 }