rlc
1
Greetings, I’m new to this community and Cakephp.
I was trying to save data to my database(MySQL).
Here’s my db structure

and here’s my code
$connection = ConnectionManager::get('default');
$connection->begin();
$indexData = [
"customer_id" => 555,
"zip_code" => 1,
"address" => 2,
"ship_fee" => 3,
"discount" => 4,
];
$entity = $this->OrderIndex->newEntity($indexData);
$res = $this->OrderIndex->save($entity);
$connection->commit();
but only “customer_id” will be stored, but others will not.
rlc
2
I figured it out myself.
CakePHP has cache for models.
Once I cleared it, it works just fine.
Nice that you have found the solution yourself 
I just wanted to inform you, that CakePHP does transactions automatically when saving entities.
So you don’t need to manually do
$connection = ConnectionManager::get('default');
$connection->begin();
// Other code
$connection->commit();
but this
$indexData = [
"customer_id" => 555,
"zip_code" => 1,
"address" => 2,
"ship_fee" => 3,
"discount" => 4,
];
$entity = $this->OrderIndex->newEntity($indexData);
$res = $this->OrderIndex->save($entity);
will automatically create a transaction
See Saving Data - 4.x
When saving, CakePHP will apply your rules, and wrap the save operation in a database transaction.