If you turn on SQL debugging, you will see that Cake fetches the record from the database if you specify an ID before save()
. If the record exists Cake will perform an update, otherwise an insert; specifying a NULL for the ID forces an insert. So what you are doing is fine.
The create()
is important if you are not filling all columns; otherwise data will remain in the object and you end up spilling data from one record to the other. create
simply resets the internal data structure.
You don't need to check for existence of your data after save()
, unless you're really paranoid. However, do check the result from save()
; if it returns false something went wrong.