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

Reply via email to