mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-09-11 16:50:46 +02:00
Return empty list if there is no more edition instead of Error 404
This commit is contained in:
@@ -182,19 +182,15 @@ class MapApiController extends AbstractController
|
||||
#[Route('/api/map/get_all_editions')]
|
||||
public function getEditions(EditionRepository $rep): JsonResponse
|
||||
{
|
||||
$edits = $rep->getAllEditions();
|
||||
if (sizeof($edits)<1) { throw new NotFoundHttpException('Warning: There is no more edition to check.'); }
|
||||
else {
|
||||
$listEdits = array();
|
||||
foreach ($edits as $edit){
|
||||
$listEdits[] = array(
|
||||
'id' => $edit->getId(),
|
||||
'mode' => $edit->getMode(),
|
||||
'placeNames' => $edit->getEditedPlace()->getJoinedNames(),
|
||||
'placeId' => $edit->getEditedPlace()->getId(),
|
||||
'editorValue' => $edit->getValue()
|
||||
);
|
||||
}
|
||||
$listEdits = array();
|
||||
foreach ($rep->getAllEditions() as $edit){
|
||||
$listEdits[] = array(
|
||||
'id' => $edit->getId(),
|
||||
'mode' => $edit->getMode(),
|
||||
'placeNames' => $edit->getEditedPlace()->getJoinedNames(),
|
||||
'placeId' => $edit->getEditedPlace()->getId(),
|
||||
'editorValue' => $edit->getValue()
|
||||
);
|
||||
}
|
||||
return $this->json($listEdits);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user