Hello there, I have a question about cf9 orm. I am trying to add a postInsert() event on a persistent cfc which basically logs the action in an audit table. My code looks like this.
public void function postInsert(){ //log the action Audit=entitynew('Audit'); Audit.setItem_type('Art'); Audit.setAction('create'); Audit.setDate_actioned(now()); Audit.setUser(this.getLast_actioned_by()); Audit.setPage(this); entitysave(Audit); } This does not work and and do not know why. When I dump the Audit object, it is there and looks perfect but it does not save it to the database. In the docs under 'Event Handling in CFC' it says "Note: When you call the EntitySave() method on an object that is not loaded using EntityLoad(), it gets updated but the intercepter call fails. This happens because an empty map is created for the object and there is no previous data associated with it. " I have no idea what this means. Does this mean that you cannot save or create another object in an event handler? Thank you in advance for any advice Gavin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324918 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4