getRepository(SphericalPhoto::class); $photos = $repo->findAll(); foreach ($photos as $key => $photo) { $coords = $repo->coordinates($photo->getId()); $photo->setLat($coords['lat']); $photo->setLng($coords['lng']); $photos[$key] = $photo; } return $this->json($photos); } #[Route('/spherical/by/gis/{gisId<[\w_]+>}', name: 'app_spherical_by_gis')] public function byGis( string $gisId, EntityManagerInterface $em ): JsonResponse { $repo = $em->getRepository(SphericalPhoto::class); $photos = $repo->findBySiteGis($gisId); foreach ($photos as $key => $photo) { $coords = $repo->coordinates($photo->getId()); $photo->setLat($coords['lat']); $photo->setLng($coords['lng']); $photos[$key] = $photo; } return $this->json($photos); } }