If you’ve tried Doctrine PHP, you might get pretty frustrated when using the $Record::synchronizeWithArray() function. Why?
$data = array('name' => 'jimbob');
$User->Doctrine::getTable('User')->find(1);
$User->synchronizeWithArray($data);
$User->save();
If you try this code you will find that the synchronizeWithArray() function deletes everything except the ‘name’ field in the record. I think the name ‘synchronize’ is slightly confusing here, as what it really means is “delete everything except what I’m explicitly telling you right now”.
A bit of digging in the API reference turned up a nice function called merge().
$data = array('name' => 'jimbob');
$User->Doctrine::getTable('User')->find(1);
$User->merge($data);
$User->save();
You will find that all the fields except ‘name’ are untouched. Lovely job.