From 060b5f43e28957c2371f9e434905ea56ce806218 Mon Sep 17 00:00:00 2001 From: Adam Schubert Date: Mon, 15 Oct 2018 17:33:50 +0200 Subject: [PATCH] Fix gallery deletion --- .../Components/Gallery/GalleryGrid/GalleryGrid.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Dravencms/AdminModule/Components/Gallery/GalleryGrid/GalleryGrid.php b/src/Dravencms/AdminModule/Components/Gallery/GalleryGrid/GalleryGrid.php index 73b9caa..39b813f 100644 --- a/src/Dravencms/AdminModule/Components/Gallery/GalleryGrid/GalleryGrid.php +++ b/src/Dravencms/AdminModule/Components/Gallery/GalleryGrid/GalleryGrid.php @@ -167,9 +167,13 @@ public function gridGroupActionDelete(array $ids) */ public function handleDelete($id) { - $locales = $this->galleryRepository->getById($id); - foreach ($locales AS $locale) + $galleries = $this->galleryRepository->getById($id); + foreach ($galleries AS $gallery) { + foreach($gallery->getPictures() AS $picture){ + $this->entityManager->remove($picture); + } + $this->entityManager->remove($locale); }