Fix the appellation selection for projet professional

This commit is contained in:
Julie Lenaerts 2024-05-23 12:46:12 +02:00
parent 33a6f9996e
commit a5c2576124
2 changed files with 14 additions and 24 deletions

View File

@ -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)

View File

@ -50,9 +50,6 @@ class RomeAppellationChoiceLoader implements ChoiceLoaderInterface
*/
protected $validator;
/**
* RomeAppellationChoiceLoader constructor.
*/
public function __construct(
EntityManagerInterface $em,
PartenaireRomeAppellation $apiAppellation,