Byron,
As promised, here is the reactor snippet. The reactor.xml was located in my webroot in a folder called sample. I created a mapping to sample/data folder to store the generated reactor objects.
I also included a basic logic to detect if you have found an address for a given staffer.
Reactor.xml:
<reactor>
<config>
<project value="sample" />
<dsn value="reactor" />
<type value="mssql" />
<mapping value="/sampleData" />
<mode value="development" />
</config>
<objects>
<object name="Staff">
<hasOne name="Address">
<relate from="staffID" to="staffID" />
</hasOne>
</object>
</objects>
</reactor>
ColdFusion Code:
<!--- load the reactor factory --->
<cfset Reactor = CreateObject("Component", "reactor.reactorFactory").init(expandPath("reactor.xml
")) />
<!--- get the staffer record for the staff person with the primary key on the staff table of 1 --->
<cfset staffRecord = reactor.createRecord("staff").load(staffID=1) />
<!--- get the address record for the staffer record loaded--->
<cfset staffAddressRecord = staffRecord.getAddress() />
<!--- the isDirty method of the staffer's address link will tell you if an address record was found or not for the staffer --->
<cfset badRead = staffAddressRecord.isDirty()>
<cfoutput>
<!--- display the staffer's name from the staff table' --->
#staffRecord.getStafferName()#<br />
<!--- if it was not a bad read of the address table for the staffer, display the address and state --->
<cfif not badRead>
<!--- get the address of the staffer from the address table --->
#staffAddressRecord.getAddress_One()#<br />
<!--- get the state of the staffer from the address table --->
#staffAddressRecord.getState()#<br />
</cfif>
</cfoutput>
--
<cf_payne />
http://cfpayne.wordpress.com/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- RE: (LONG) Re: [Reactor for CF] SharedKey Doug Hughes
- RE: (LONG) Re: [Reactor for CF] SharedKey Doug Hughes
- RE: (LONG) Re: [Reactor for CF] SharedKey Joshua Scott
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Joe Rinehart
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- RE: (LONG) Re: [Reactor for CF] SharedKey João Fernandes
- Re: (LONG) Re: [Reactor for CF] SharedKey Teddy Payne
- Re: (LONG) Re: [Reactor for CF] SharedKey Byron Raines
