Andy,
Shouldn't it be:
<objects name="pet_breed" alias="pet_breed">
<hasMany name="pets">
<relate from="pet_breed_id" to="pet_breed_id" />
</hasMany>
</objects>
so each breed has many pets?
Kevin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Dave Shuck
Sent: 26 March 2007 00:41
To: [email protected]
Subject: Re: [Reactor for CF] Iterator
Andy and iterator is only in play when you have a hasMany relationship.
You can get a handle on your pet_breed with:
<cfset pet = reactor.createRecord("pets").load(petid=1) />
Then see breed like this:
<cfdump var="#pet.getpet_breed()#">
~Dave
On 3/25/07, Andy Jarrett <[EMAIL PROTECTED] > wrote:
Hi there,
I cannot seem to get the "iterator" functions to work but cannot see
what I'm doing wrong either. Below is my Reactor File
<objects name="pets" alias="pets">
<hasOne name="pet_breed">
<relate from="pet_breed_id" to=pet_breed_id" />
</hasOne>
</objects>
<objects name="pet_breed" alias="pet_breed">
<hasOne name="pets">
<relate from="pet_breed_id" to="pet_breed_id" />
</hasOne>
</objects>
The code
<cfset reactor = CreateObject("Component",
"reactor.reactorFactory").init(expandPath("/config/reactor.xml")) />
<cfset pet = reactor.createRecord("pets") />
<cfset pet.setpetid(1) />
<cfset pet.load() />
<cfdump var="#pet#">
I've set up the foreign keys from the Pets table on the pet_breed_id
column as well. Doesn't matter what I do there is no Iterator
available on pet_breed_id.
Any ideas on where I am going wrong?
Cheers, Andy
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- --
--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
Where's your Spot?
www.instantspot.com
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --