I have Users -> hasMany -> Pupils -> hasMany -> EduHistories
I save them by associated Entity like below
$user = $this->Users->newEntity($userData, [
'associated' => ['Pupils.EduHistories']
]);
The Pupils[0] saved OK with a correct ID, the EduHistories[0] is also OK with correct ID of Pupils[0].
However, the Pupils[0] always has user_id = 1, even the Users is saved, with no error, and ID is something else.
I am not assigning ID manually to any of them. They all new entities.
And I check associations in Models tables, they seem to be fine.
What could possibly wrong?
Thank you for your help.