Hi everyone,
Just curious how you would handle the following scenario with a 'User'
business object:
User.cfc
UserService.cfc
UserGateway.cfc
UserDAO.cfc
The UserService is composed with UserGateway and UserDAO for data
access operations.
Now, I want more 'behavioural' methods in my User.cfc as I don't want
it to simply be a 'bean'. Let's say I have a User.validate() method,
part of which looks up a database to see if the current users email
has already been added to the system. As the validate() method is in
the business object (and not the Service) would you compose the DAO
into the User object as well? I.e. how do I manage database access
from the business object?
I imagine doing it this way would be a pass by reference (either by a
factory or ColdSpring etc) so the 'cost' is ok because you won't be
instantiating a new cfc. Just means my UserService AND my User both
have a composed UserDAO. Is this a commonly used pattern?
My next question is if the UserDAO has a read() method which returns
an instance of User, how does the UserDAO get composed into this new
User object? Via something like:
createObject("component", "com.User").init(userDAO=this);?
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CFCDev" group.
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/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---