"Do I need to set the donor id manually somehow ?"
Yes.
More explanation:
In cake, if you want to update something, you need to pass the id, otherwise you'll create a new record. You can also "load" the model instance like
$this->Model->id = $id;
and then the save will update the row with that id. But I always find it more mentally-safe to add the id to the saved array, specially when using saveAll
, saveMany
and saveAssociated
.
In your case, you must have the donor's id somewhere, cake is not that magical and it won't know what donor you are refering to.
Something like this
$this->request->data['Donor']['id'] = $the_id;
will do the trick.
... or you can save the donor's last_donated time with a different query, if it's giving you too much trouble.