Basically, I have a piece of code that looks like this:
$this->ModelName->id = $id;
$this->ModelName->save(
array('ModelName'=>array(
'boolean_column1'=>1,
'boolean_column2'=>0,
'string_column'=>'Some short string[always the same]'
)));
Sometimes this save fails. So I added the following:
debug($this->ModelName->validationErrors);
debug($this->ModelName->invalidFields());
And the results are:
########## DEBUG ##########
array(
(int) 0 => array()
)
###########################
########## DEBUG ##########
array(
(int) 0 => array()
)
###########################
When I set the "validate" param to false then this doesn't happen. I have also tried changing the save array in a way that doesn't have the 'ModelName' key, but it didn't help.
There aren't any beforeSave or afterSave callbacks, nor is there a $validate setting in this Model. There are more fields then there are being saved in this call, but this is updating an existing row in the database table.
This is code that runs cyclically in a Queue as part of an hour long cron job. I'm seeing different behaviours on different runs, which could be due to other queued functions changing something that causes issues, but I'm not seeing it, and it's difficult to find without a readable error message. This started happening after upgrading to 2.7.0 from 2.4.x and has worked fine since 1.3.x.
UPDATE 1: Ok, so I've updated the Model.php file to the version in the unreleased 2.8 branch, which includes a bugfix for 'atomic', and it's working now. If I manage to find out what was causing it precisely, I'll update here.