I have writen some custom code in a save model which I need to be able to detect if a record is being created or updated
I thought I could do this by detecting if ID was specified as a new record would not have an ID, but this was not correct.. here is the sniippet of code. How can I alter it to detect NEW or UPDATED record
Here is the code... in ALL instances wether creating a new record or updating it, $data[ID] is always true
if (parent::save($data)) {
if (isset($data['id'])) {
// do this
} else {
// do that
}
return true;
}