Coldfusion9 ORM

2009-07-24 Thread Gavin Stewart

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


Re: Coldfusion9 ORM

2009-07-24 Thread Gavin Stewart

Be sure to turn on event handling in Application.cfc,
this.ormsettins.eventhandling = true;

I have done this and it does definatley trigger the event. I can dump out the 
Audit object in the event handler and I see it there. It just doesnt save to 
the database. There are no errors, logs or any reasons why it has not been 
saved to the database 

~|
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:324921
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Coldfusion9 ORM

2009-07-24 Thread Gavin Stewart

1)  Are you sure you are looking at the correct data source?
2) Have you run a trace on the database while the page execute to
confirm if _any_ SQL is being run?

1) Yes as far as i know you can only use one data source in orm.
2) The insert statement gets executed in the object but the Audit object does 
not get saved on the postInsert() event. 

~|
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:324930
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Converting Year to Integer

2009-07-24 Thread Gavin Stewart

Yes thats a typo in my email.Adding ## sign does not help 



 you need to remove the quotes araound 2000



~|
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:324932
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4