Whenever a record is added through insert() the result should either be false or the PK of the newly created record. I noticed that this is not the case because i was using the SOAP services (UserContent/addSet) and expected the set_id as a return value. Instead i got false even upon success.
I believe the reason for this is a bug in BaseModelWithAttributes and BundlableLabelableBaseModelWithAttributes. There, the return value of the calls to parent::insert are ignored. Please review the patch I attached. It works for me but i'm unsure whether this has repercussions anywhere else. We would like to get this upstream asap.
I am having this problem on both the trunk and cleanup_before_release branch.
I merged the change to BaseModelWithAttributes in cleanup_before_release
The one in BundlableLabelableBaseModelWithAttributes was already in cleanup_before_release.
Thanks for the fix - this also explains why the md5 and original_filename fields of ca_object_representations were not set on insert, but only on update.