From 6f9a9ca2362ede7281072c5a7752b08e752a6430 Mon Sep 17 00:00:00 2001 From: iglocska Date: Mon, 22 Jun 2020 17:50:10 +0200 Subject: [PATCH] fix: [internal] Correct way of fetching the ID of the new entity --- src/Model/Table/UsersTable.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php index 21001b4..acdbd26 100644 --- a/src/Model/Table/UsersTable.php +++ b/src/Model/Table/UsersTable.php @@ -52,18 +52,16 @@ class UsersTable extends AppTable 'perm_admin' => 1 ]); $this->Roles->save($role); - $roleId = $this->Roles->id; $this->Individuals = TableRegistry::get('Individuals'); $individual = $this->Individual->newEntity([ 'email' => 'admin@admin.test' ]); $this->Individuals->save($individual); - $individualId = $this->Individuals->id; $user = $this->newEntity([ 'username' => 'admin', 'password' => 'Password1234', - 'individual_id' => $individualId, - 'role_id' => $roleId + 'individual_id' => $individual->id, + 'role_id' => $role->id ]); $this->save($user); }