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
|
'perm_admin' => 1
|
||||||
]);
|
]);
|
||||||
$this->Roles->save($role);
|
$this->Roles->save($role);
|
||||||
$roleId = $this->Roles->id;
|
|
||||||
$this->Individuals = TableRegistry::get('Individuals');
|
$this->Individuals = TableRegistry::get('Individuals');
|
||||||
$individual = $this->Individual->newEntity([
|
$individual = $this->Individual->newEntity([
|
||||||
'email' => 'admin@admin.test'
|
'email' => 'admin@admin.test'
|
||||||
]);
|
]);
|
||||||
$this->Individuals->save($individual);
|
$this->Individuals->save($individual);
|
||||||
$individualId = $this->Individuals->id;
|
|
||||||
$user = $this->newEntity([
|
$user = $this->newEntity([
|
||||||
'username' => 'admin',
|
'username' => 'admin',
|
||||||
'password' => 'Password1234',
|
'password' => 'Password1234',
|
||||||
'individual_id' => $individualId,
|
'individual_id' => $individual->id,
|
||||||
'role_id' => $roleId
|
'role_id' => $role->id
|
||||||
]);
|
]);
|
||||||
$this->save($user);
|
$this->save($user);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue