Hi Everyone, This is a just a message to thanks everyone and specifically, Steve Onnis and Dale Fraser and Jim Demetriou for all the help I received with the error I was having using ColdSpring. It's a little lengthy - just in case someone googles the same issue sometime...
I had the following setup; AbstractService * has onMissingMethod() to dynamically call the method in the gateway class - if not found in the service. This means I don;t have to write "rpxy" functions in the service - just to call the method in the gateway, MessageService * extends AbstractService to inherit onMissingMethod * Potentially - has nothing in it at all. MessageGateway * extends ColdSpring AbstractGateway * Potentially - has nothing in it at all. Message * the message class with defined properties. I had a very simple CFM - that kept on failing - it had only two lines it; myMessage = messageService.getMessage(555); messageService.saveMessage(myMessage); Everything was working fine. Then I had a new requirement to add some logging for when a record was written (updates / save new / deletes) We already have a method defined for this - so what I really needed to do was simply call my existing logging function. Since it is a function call - it seemed appropriate to put this logging code into the MessageService class - it wasn't SQL/HQL/entityXXX() - so it didn't belong in the gateway. I overloaded the onMissingMethod in the MessageService class; this is what I came up with - that wasn't working. public function onMissingMethod(string missingMethodName, struct missingMethodArguments) { /* Call the method in the gateway */ var returnedVal = evaluate("getData().#missingMethodName#(argumentCollection=missingMethodArguments)"); /* See if we need to do any logging for this event. If we do - retrieve the appropriate message to log */ var auditMessageStr = getAuditMessage(arguments.missingMethodName); if(auditMessageStr.hasAuditMessage AND len(auditMessageStr.auditMessage) GT 0) { /* do any required logging using the message */ writeOutput(auditMessageStr.auditMessage); } return returnedVal; } I kept getting an error stating that "returnedVal" was undefined. I could load the object / dump the object - isDefined seemingly told me that the returnedVal was there too. It simply didn't make sense.. At the end of the CFUG, the "stragglers" all tried to help get it working for me. We tried; * getting rid of the evaluate * splitting up the dyamic creation of the method name from the execution... * change var names * change var scopes * removed the var keyword entirely... we seemingly tried everything. Thankfully, Steve got me to open up the CS AbstractGateway cfc and walk through the onMissingMethod and the methods it calls. Subsequently he quickly pointed out that the SAVE method was void and wasn't returning anything... Effectively when the CFM was running the SAVE() method - there was no value to be returned with the MessageService.onMissingMethod(), Adding in some appropriate checking for a null return quickly had it sorted out! my code; return returnedVal; changes to; if(isNull(returnedVal)) { return arguments.missingMethodArguments[1]; } else { return returnedVal; } and all was good in the world! (I was tempted to use AOP - but AOP adds another, almost quasi application into the mix and I didn't like the separation.) Anyway - a big thanks to everyone that stuck around trying to help - I really appreciate it. Gavin. -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To view this discussion on the web visit https://groups.google.com/d/msg/cfaussie/-/Ur1-toKlAGkJ. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.