You
should have the relationship defined in the Reactor.xml file. In the
<objects> tag, you should have a definition for the customer and the
address something like:
<objects><object name="Customer"><hasOne name="Address"><relate from="customer_id" to="customer_id"/></hasOne></object><object name="Address"><hasMany name="Customer"><relate from="customer_id" to="customer_id"/></hasMany></object></objects>
Or something like
that, depending on how your two objects are related. I think that's how
the docs describe the example.
Personally, I'd
think that a customer may have multiple addresses, but each address only has one
customer associated with it... Assume I'm selling to larger
businesses, and they've got multiple shipping locations. In that case, my
Reactor.xml might have something like the following:
<objects><object name="Customer"><hasMany name="Address"><relate from="customer_id" to="customer_id"/></hasMany></object><object name="Address"><hasOne name="Customer"><relate from="customer_id" to="customer_id"/></hasOne></object></objects>
In this case,
I'll use an iterator to access a customer's related address
records.
Hope this
helps...
-matt
Matthew Newby
PNS Web
Services
PH: 207-438-5263
email: [EMAIL PROTECTED]
When digitally signed, the signature is in
accordance with DoDI
8520.2, dated 1 Apr 2004.
-----Original Message-----I've been going through the Reactor tutorial. I have a MySQL database, and right now I'm stuck at the point where I need to configure relationships in Reactor. Here's what I have in CustomerRecord.cfm:
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Lola Lee
Sent: Thursday, July 06, 2006 11:52 AM
To: [email protected]
Subject: [Reactor for CF] problem with getAddressRecord Function from Reaction tutorial
<!--- create the reactor factory --->
<cfset Reactor = CreateObject("Component", "reactor.reactorFactory ").init(expandPath("reactor.xml")) />
<!--- creatre a customer record --->
<cfset CustomerRecord = Reactor.createRecord("Customer") />
<cfdump var = "#CustomerRecord#">
<br />
<cfdump var="#CustomerRecord.getAddressRecord()#" />
However, at this line "<cfdump var="#CustomerRecord.getAddressRecord()#" />", it errors out, with the following message:
The method 'getAddressRecord' could not be found in component /Library/WebServer/Documents/ScratchReactor/Data/Record/CustomerRecordmysql.cfc.
Check to ensure that the method is defined, and that it is spelled correctly.
The error occurred in /Library/WebServer/Documents/ScratchReactor/CustomerRecord.cfm: line 9
7 : <cfdump var = "#CustomerRecord#">
8 : <br />
9 : <cfdump var="#CustomerRecord.getAddressRecord()#" />
Looking at the dump for CustomerRecords, I'm not seeing "getAddressRecord". The referenced file does exist. What is causing this to occur? I do have records for Address, Customer and Users.
I think I'm using the latest version . . .
Lola J. Lee Beno
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

