/** * @param string $className * @param array $groups * @param string $format * * @return mixed * * @throws BadRequestException */ protected function deserializeRequest($className, $groups = array(SerializationGroup::EDIT), $format = 'json') { $context = DeserializationContext::create()->setGroups($groups); try { $object = $this->serializer->deserialize($this->requestStack->getCurrentRequest()->getContent(), $className, $format, $context); } catch (\Exception $e) { $exception = new BadRequestException(); $exception->setInfo($e->getMessage()); throw $exception; } return $object; }
/** * @param integer $id * * @return FullPlaceResult * @throws \Tastd\Bundle\CoreBundle\Exception\Api\Http\BadRequestException */ public function detail($id) { $params = array('placeid' => $id, 'key' => $this->apiKey); try { $response = $this->browser->get(new Url(self::DETAIL_URL, $params)); } catch (\Exception $e) { $exception = new BadRequestException(); $exception->setInfo($e->getMessage()); throw $exception; } return $this->parseDetailResponse($response); }