mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-05 06:55:27 +01:00
Fixed exception when trying to export an empty entity list
Fixes issue #836
This commit is contained in:
@@ -467,6 +467,11 @@ abstract class BaseAdminController extends AbstractController
|
||||
$this->denyAccessUnlessGranted('read', $entity);
|
||||
$entities = $em->getRepository($this->entity_class)->findAll();
|
||||
|
||||
if (count($entities) === 0) {
|
||||
$this->addFlash('error', 'entity.export.flash.error.no_entities');
|
||||
return $this->redirectToRoute($this->route_base.'_new');
|
||||
}
|
||||
|
||||
return $exporter->exportEntityFromRequest($entities, $request);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user