From d7bf8af5b16d134b7aaa00270d7cd20ff4eb1b1a Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 28 Jun 2023 15:01:26 +0200 Subject: [PATCH] fix: [internal] user add fix attempt #2 --- src/Controller/UsersController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controller/UsersController.php b/src/Controller/UsersController.php index d33490c..574d344 100644 --- a/src/Controller/UsersController.php +++ b/src/Controller/UsersController.php @@ -74,10 +74,11 @@ class UsersController extends AppController } else { $validRoles = $this->Users->Roles->find('list')->order(['name' => 'asc'])->all()->toArray(); } - $defaultRole = $this->Users->Roles->find()->select(['id'])->where(['is_default' => true])->first()->toArray(); + $defaultRole = $this->Users->Roles->find()->select(['id'])->where(['is_default' => true])->first(); if (empty($defaultRole)) { - $defaultRole = $this->Users->Roles->find()->select(['id'])->first()->toArray(); + $defaultRole = $this->Users->Roles->find()->select(['id'])->first(); } + $defaultRole = $defaultRole->toArray(); $individuals = $this->Users->Individuals->find('list', $individuals_params)->toArray(); $this->CRUD->add([ 'beforeMarshal' => function($data) {