Argument 1 passed to Cake\Database\TypeFactory::build() must be of the type string, null given, called in /home/.../vendor/cakephp/cakephp/src/ORM/Table.php on line 2115

I just baked model, controller and template from a table called lastalives which have 3 fields: [machine_id (int), stock (decimal 10,2) and timestamp (datetime)].

When I try to add a new lastalive, I get the following error message:

Argument 1 passed to Cake\Database\TypeFactory::build() must be of the type string, null given, called in /home/…/vendor/cakephp/cakephp/src/ORM/Table.php on line 2115

What might be the problem? I’m using CakePHP 4.3.7, php 7.4 and mysql 8.0

SOLVED

It was because machine_id was the primary key and I didnt modify LastalivesTable. It should be " $this->setPrimaryKey(‘machine_id’);"