From ea9e2fba77842bd3a2dd243e3cf161c6670cc6d1 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Tue, 9 Jun 2020 09:36:47 +0200 Subject: [PATCH] chg: [galaxies:delete] Allow deletion by uuid --- app/Controller/GalaxiesController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Controller/GalaxiesController.php b/app/Controller/GalaxiesController.php index 190300422..498a7c6ba 100644 --- a/app/Controller/GalaxiesController.php +++ b/app/Controller/GalaxiesController.php @@ -114,9 +114,12 @@ class GalaxiesController extends AppController public function delete($id) { - if (!is_numeric($id)) { + if (Validation::uuid($id)) { + $id = $this->Toolbox->findIdByUuid($this->Galaxy, $id); + } elseif (!is_numeric($id)) { throw new NotFoundException('Invalid galaxy.'); } + $galaxy = $this->Galaxy->find('first', array( 'recursive' => -1, 'conditions' => array('Galaxy.id' => $id)