The gateway has a getByAttributesQuery method. Use this for a query and change 
the service cfc to use this on your 'getreleasess()' method.

To save yourself doing this all the time you can make customise the generator 
to generate the cfc's they way you want them.

Also, a good tip .... these generated gateways and DAO's .... when you want to 
add more methods etc do it in a different cfc and subclass the generated ones 
with your custom ones.

Then if you add or remove columns from the db table the gateways and DAO's are 
based on you can just regen the cfc's and overwrite without worrying about all 
your custom stuff.

It doesn't work so well with services as my services are usually assosiated 
with more than one Gateway and DAO.

Another option is Transfer (before someone recommends it :-) )

Alan
________________________________________
From: [email protected] [EMAIL PROTECTED] On Behalf Of wkolcz [EMAIL 
PROTECTED]
Sent: 06 May 2008 12:36
To: [email protected]
Subject: [CFCDEV] Help in learning service objects: How to use

I downloaded and installed Brian Rinaldi's Illudium PU-36 Code Generator. It 
produced a DAO, a Gateway, a bean, and a service object. I am attempting to 
learn how a service object works, or, more imporantly, how to use the service 
object. It comes with the following functions. (mine happens to be 
releasesServices.cfc)

init (takes an instance of the DAO and the Gateway)
createreleases
getreleases
getreleasess
savereleases
deletereleases

So basically, I am getting the DAO (create,get,save,delete) and a Gateway 
(getreleasess)? How can I call the gateway to return a list of records. Or, 
more important, how can I use the results on my view? Its returned as an array. 
What am I missing. I need the education :-)

I can setting my controller to:
<cfset RDAO = createObject("component", 
"medPortal.apps.newsroom.model.releases.releasesDAO").init("prmc-media_asql")>
        <cfset RGW = createObject("component", 
"medPortal.apps.newsroom.model.releases.releasesGateway").init("prmc-media_asql")>
        <cfset RS = createObject("component", 
"medPortal.apps.newsroom.model.releases.releasesService").init(#RDAO#, #RGW#)>
        <cfset allReleases = RS.getreleasess()>

Here is the full function:
    <cffunction name="getreleasess" access="public" output="false" 
returntype="array">
        <cfargument name="ID" type="Numeric" required="false" />
        <cfargument name="urllink" type="String" required="false" />
        <cfargument name="linktext" type="String" required="false" />
        <cfargument name="story" type="String" required="false" />
        <cfargument name="summary" type="String" required="false" />
        <cfargument name="keyword1" type="String" required="false" />
        <cfargument name="keyword2" type="String" required="false" />
        <cfargument name="keyword3" type="String" required="false" />
        <cfargument name="keyword4" type="String" required="false" />
        <cfargument name="um_department" type="String" required="false" />
        <cfargument name="photo" type="String" required="false" />
        <cfargument name="hiresphoto" type="String" required="false" />
        <cfargument name="releaseDate" type="Date" required="false" />
        <cfargument name="rss_feed" type="String" required="false" />
        <cfargument name="contactName" type="String" required="false" />
        <cfargument name="contactEmail" type="String" required="false" />
        <cfargument name="contactPhone" type="String" required="false" />
        <cfargument name="guestEmail" type="String" required="false" />
        <cfargument name="guestName" type="String" required="false" />
        <cfargument name="subTitle" type="String" required="false" />
        <cfargument name="city" type="String" required="false" />
        <cfargument name="videoCode" type="String" required="false" />
        <cfargument name="audioCode" type="String" required="false" />
        <cfargument name="ExpertName" type="String" required="false" />
        <cfargument name="ExpertURL" type="String" required="false" />
        <cfargument name="learnMoreText" type="String" required="false" />
        <cfargument name="learnMoreURL" type="String" required="false" />
        <cfargument name="studyURL" type="String" required="false" />
        <cfargument name="reportURL" type="String" required="false" />
        <cfargument name="topStory" type="Boolean" required="false" />
        <cfargument name="photoCaption" type="String" required="false" />
        <cfargument name="spanishURL" type="String" required="false" />
        <cfargument name="defaultLogo" type="String" required="false" />

        <cfreturn 
variables.releasesGateway.getByAttributes(argumentCollection=arguments) />
    </cffunction>



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to