/** * Get Global City * * @param unknown_type $id * @return NULL|mixed */ public function getGlobalCityById($id) { $response = $this->request->get($this->chromediaApiUri . '/cities/' . $id); if (200 != $response->getStatusCode()) { if (404 == $response->getStatusCode()) { return null; } else { throw LocationServiceException::failedApiRequest($response->getRequest()->getUrl(false), $response->getBody(true)); } } return \json_decode($response->getBody(true), true); }
/** * Find an account in global chromedia by accountId * * @param \HealthCareAbroad\UserBundle\Entity\SiteUser $user * @return SiteUser */ public function getUser(\HealthCareAbroad\UserBundle\Entity\SiteUser $user) { if ($user->getAccountId()) { $response = $this->request->get($this->chromediaAccountsUri . '/' . $user->getAccountId()); if (200 == $response->getStatusCode()) { $accountData = \json_decode($response->getBody(true), true); return $this->hydrateAccountData($user, $accountData); } else { throw new FailedAccountRequestException($response->getBody(true)); } } else { throw new FailedAccountRequestException("Cannot get Account with no id"); } }