Hi guys

I've got some logic in my listener which I is duplicated over 2
funcitons. I thought about calling the re-usable functionA from
functionB within the listener but this sounds wrong especially because
I'm accessing event Args in the functionA so if I was to re-use it I'd
need to be sure that I overwrite event Args when I call functionA
repeatedly from funcitonB. Lots of room for error and nightmare if it
goes wrong.

I know you'll say that this sounds too much like business logic so
should drop down into the service layer but that doesn't make sense to
me either. What I'm doing is I have 2 objects which are related. I
take form data, populate objectA, pass it to the service layer for
validation/saving, and then return the Id. This Id is then injected
into objectB along with other form data and then also passed to the
service layer for validating/saving. There's a few other minor things
like setting some session vars etc but that's about it for functionA.

So from functionB I'm looping through a query and therefore want to
hit the funcitonA logic more than once.

Perhaps I'm using my listenters all wrong. My approach is to generate
an empty bean in the listener, populate it with the form data (via the
event Args of course) and then pass it to the service for validating /
saving. May I should build a structre and pass it to the service
object for bean creation / population and saving but then I'm creating
more work because I have to build a structure in the listener, then
pass it to the service? Another option may be to add arguments to my
service function and pass required items in but again this is a lot
more code. Any ideas?

Cheers
Matthew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: 
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
-~----------~----~----~----~------~----~------~--~---

Reply via email to