fix: [internal] Correct way of fetching the ID of the new entity
parent
e5e7feff35
commit
6f9a9ca236
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue