diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php index cb40311b6..b2a3db3ac 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php +++ b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php @@ -65,30 +65,23 @@ class PartenaireRomeAppellation { $bearer = $this->getBearer(); - $request = new Request('GET', 'appellation'); - $parameters = [ - 'query' => [ - 'q' => $search, - 'fq' => 'libelle', - ], - 'headers' => [ - 'Authorization' => 'Bearer '.$bearer, - ], - ]; try { - $response = $this->handleRequest( - $request, - $parameters, - $this->client, - $this->logger - ); + $response = $this->httpClient->request( + 'GET', self::BASE . 'appellation/requete', [ + 'headers' => [ + 'Authorization' => 'Bearer '.$bearer, + 'Accept' => 'application/json', + ], + 'query' => [ + 'q' => $search + ], + ] + ); - return Utils::jsonDecode((string) $response->getBody()); - } catch (ClientException $e) { - dump($e->getResponse()->getBody()->getContents()); + return $response->toArray()['resultats']; + } catch (HttpExceptionInterface $exception) { + throw $exception; } - - return new Response('No appellation found'); } public function getAppellation($code) diff --git a/src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php b/src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php index 0952991e4..83f1f85a1 100644 --- a/src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php +++ b/src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php @@ -50,9 +50,6 @@ class RomeAppellationChoiceLoader implements ChoiceLoaderInterface */ protected $validator; - /** - * RomeAppellationChoiceLoader constructor. - */ public function __construct( EntityManagerInterface $em, PartenaireRomeAppellation $apiAppellation,