fix: [internal] Correct way of fetching the ID of the new entity

remotes/origin/main
iglocska 2020-06-22 17:50:10 +02:00
parent e5e7feff35
commit 6f9a9ca236
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}