Closed
Description
This code:
if (! empty($properties) && ! empty($primaryKey) && ! in_array($primaryKey, $properties))
{
$properties[$primaryKey] = $data->{$primaryKey};
}
breaks all my app. When I try to insert a row, in example this row:
name: John
age: 21
CodeIgniter add field from primaryKey and fill value to NULL. And postgres got error because id can`t be null
Code for reproduction:
$user = new App\Entities\User;
$user->fill([
'name' => 'John',
'age' => 21,
]);
$userModel->save($user);
// and we get error because primary key of userModel can`t be null
Activity