> maybe for integrate all functions related to news in one > CFC? Yes. Additionaly it will handle cftransactions and adding records to the many-to-many relationship tables in the createNews function for example.
Murat. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Xavi > Sent: Wednesday, November 17, 2004 6:21 PM > To: [EMAIL PROTECTED] > Subject: Re: DAO Semantics WAS: RE: [CFCDev] table DAO > > I dont know why u need a newsmanager having a newsDAO and a > newsgateway, maybe for integrate all functions related to news in one > CFC? > > > On Wed, 17 Nov 2004 17:55:27 +0200, Murat Demirci > <[EMAIL PROTECTED]> wrote: > > For example you have a NEWS table that stores all news; > fields of it: > > > > NEWS > > ----------------------------------------- > > ID NUMBER(10) > > TITLE VARCHAR2(4000) > > BODY CLOB > > > > The structure of newsbean.cfc: > > > > <cfcomponent> > > <cfset variables.id="" /> > > <cfset variables.title="" /> > > <cfset variables.body="" /> > > > > <cffunction name="init" access="public" returntype="any"> > > <cfargument name="_id" type="string" required="no" > > default="" /> > > <cfargument name="_title" type="string" > required="no" > > default="" /> > > <cfargument name="_body" type="string" required="no" > > default="" /> > > <cfset id = _id /> > > <cfset title = _title /> > > <cfset body = _body /> > > <cfreturn this /> > > </cffunction> > > > > <cffunction name="setId" access="public"> > > <cfargument name="_id" type="string" > required="yes" /> > > <cfset id = _id /> > > </cffunction> > > > > <cffunction name="getId" access="public" > returntype="string"> > > <cfreturn id /> > > </cffunction> > > ...... // the other getters/setters; if you don't > use Mach-II I > > suggest to use correct datatypes instead of "string" > > </cfcomponent> > > > > The structure of newsmanager.cfc: > > > > <cfcomponent> > > <cfset variables.dsn = "" /> > > <cffunction name="init" access="public" returntype="any"> > > <cfargument name="dsn" type="string" > required="yes" /> > > <cfset variables.dsn = arguments.dsn /> > > <cfset variables.newsDAO = createObject("component", > > "model.news.newsdao").init(variables.dsn) /> > > <cfset variables.newsGateway = > createObject("component", > > "model.news.newsgateway").init(variables.dsn) /> > > <cfreturn this /> > > </cffunction> > > > > <cffunction name="createNews" access="public" output="false" > > returntype="numeric"> > > <cfargument name="newsBean" type="newsbean" > required="yes"/> > > <cfset var newId = 0 /> > > <cfset newId = newsDAO.create(arguments.newsBean)/> > > <cfreturn newId/> > > </cffunction> > > > > <cffunction name="readNews" access="public" output="false"> > > <cfargument name="newsBean" type="dosyabean" > > required="yes"/> > > <cfargument name="id" type="numeric" > required="yes"/> > > <cfset newsDAO.read(arguments.newsBean, > arguments.id)/> > > </cffunction> > > > > <cffunction name="updateNews" access="public" > output="false"> > > <cfargument name="newsBean" type="dosyabean" > > required="yes"/> > > <cfargument name="id" type="numeric" > required="yes"/> > > <cfset newsDAO.update(arguments.newsBean, > arguments.id)/> > > </cffunction> > > > > <cffunction name="deleteNews" access="public" > output="false"> > > <cfargument name="id" type="numeric" > required="yes"/> > > <cfset newsDAO.delete(arguments.id)/> > > </cffunction> > > > > <cffunction name="getNewsById" access="public" > output="false" > > returntype="query"> > > <cfargument name="id" type="string" > required="yes" /> > > <cfargument name="sortExpression" required="no" > > type="string"/> > > <cfargument name="sortDirection" required="no" > > type="string"/> > > <cfreturn > variables.newsPortal.getNewsById(arguments.id, > > arguments.sortExpression, arguments.sortDirection)/> > > </cffunction> > > .... // other functions > > </cfcomponent> > > > > In time we need some function libraries to use in modules, > we've covered the > > issue using utility.cfcs when necessary. For example we've > developed a > > wizard form with four steps. And we need to check the url > and form values to > > ensure the user isn't trying to access the last step > without filling the > > previous steps. We've developed a function to be sure the > steps are filled > > and validated by checking the values in session. We've > stored that function > > in the utility.cfc of the module to share among listener cfcs. > > > > Murat. > > > > > -----Original Message----- > > > From: Tangorre, Michael [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, November 17, 2004 4:15 PM > > > To: Murat Demirci > > > Subject: RE: DAO Semantics WAS: RE: [CFCDev] table DAO > > > > > > Murat, > > > > > > I am just getting into taking an OO approach to my > > > applications in CF. I > > > have been using Fusebox for years, but it is time to > venture off into > > > other terratories. > > > In your post below from CFCDev, I understand what goes in > > > table1dao.cfc > > > and tablegateway.cfc, but could you give me a quick snapshot > > > of what the > > > bean, manager, and utility cfcs do? > > > > > > Thanks! > > > > > > Michael T. Tangorre > > > > > > > > > > > -----Original Message----- > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Murat Demirci > > > > I prefer to follow Sean's suggestion. I don't see any problem > > > > with it. To verify whether I understood it properly I'm > > > > sending my basic model > > > > structure: > > > > > > > > mysite.com > > > > ---/model > > > > ------/module1 > > > > ---------table1dao.cfc > > > > ---------table1bean.cfc > > > > ---------table1gateway.cfc > > > > ---------table1manager.cfc > > > > ---------utility.cfc (sometimes necessary for some > > > > module-wide operations) > > > > -------/module2 > > > > ---------tableAdao.cfc > > > > ---------tableAbean.cfc > > > > ---------tableAgateway.cfc > > > > ---------tableAmanager.cfc > > > > > > > > > > ---------------------------------------------------------- > > You are subscribed to cfcdev. To unsubscribe, send an email > > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > > in the message of the email. > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported > > by Mindtool, Corporation (www.mindtool.com). > > > > An archive of the CFCDev list is available at > [EMAIL PROTECTED] > > > > > -- > Xavi (http://xavicl.blogspot.com) > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > in the message of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported > by Mindtool, Corporation (www.mindtool.com). > > An archive of the CFCDev list is available at > [EMAIL PROTECTED] > > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at [EMAIL PROTECTED]
