Patrick, base and custom components exist exactly for that, to override or add functions that you'll need.
Also, _getReactorFactory() is the right way to go. If _getReactorFactory() go away man,I hope it will be only in Reactor 5.0. Anyway, don't forget that it's beta but I think that Doug already locked the API so... João Fernandes PS: You don't wanna know how many times I changed code due to API changes :) -----Original Message----- From: [EMAIL PROTECTED] on behalf of Patrick McElhaney Sent: Thu 27-Jul-06 5:49 PM To: [email protected] Subject: [Reactor for CF] Is this an ugly hack? <cfcomponent hint="..." extends="reactor.project.foo.Record.Articles_WorkingCopiesRecord" > <cffunction name="afterLoad"> <cfset var article = _getReactorFactory().createRecord("Articles")/> <cfif doesNotExist()> <cfset article.load(articleID = this.getArticleID())/> <cfset this.setMiniHeadline(article.getMiniHeadline())/> <cfset this.setHeadline(article.getHeadline())/> <cfset this.getDepartment(article.getDepartment())/> <cfset this.setBody(article.getBody())/> </cfif> <cfset super.afterLoad()/> </cffunction> </cfcomponent> This CFC overrides the afterLoad() method for a Record object (which is called at the end of the load() method). If there's not a record in the Articles_WorkingCopies table already, I want to initialize this record with data from the Articles table. I have two questions. 1. Is it okay for me to override the afterLoad() function? The function appears to be designed with that purpose in mind. 2. Is it okay to call _getReactorFactory() from a subclass? Technically, these are both possible, and work great. But now I've hung dependencies on the afterLoad() and _getReactorFactory() methods. If those methods ever change or go away, my code will break. I wouldn't consider it a priority at this point, but eventually I think these questions should be answered in the hint attributes the cffunction tags. And I'm more than willing to help with that effort. :) Patrick -- Patrick McElhaney 704.560.9117 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
<<winmail.dat>>
