I think you've got an error in your XML config.

Shouldn't those be relate tags in AssetRegion?

                <object name="AssetRegion">
                        <hasOne name="Asset">
                                <relate from="asset" to="assetID" />
                        </hasOne>
                        <hasOne name="Region">
                                <relate from="region" to="regionID" />
                        </hasOne>
                </object>

Hence the name attribute not found error
I'm new to this too, so I may have misunderstood :)

Chris


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ken
Dunnington
Sent: 21 February 2006 22:21
To: [email protected]
Subject: [Reactor For CF] Re: Iterator questions

I take it back, the first issue is the more pressing one. I'm getting
this LINK.XMLATTRIBUTES.NAME is undefined in RELATIONSHIP error
whenever I try to get an Iterator from a Record. What am I doing wrong
here?

This is my Reactor.xml file:
                <!-- Assets -->
                <object name="Asset">
                        <hasMany name="Region">
                                <link name="AssetRegion" />
                        </hasMany>
                </object>
                <object name="Region">
                        <hasMany name="Asset">
                                <link name="AssetRegion" />
                        </hasMany>
                </object>
                <object name="AssetRegion">
                        <hasOne name="Asset">
                                <link from="asset" to="assetID" />
                        </hasOne>
                        <hasOne name="Region">
                                <link from="region" to="regionID" />
                        </hasOne>
                </object>

In my controller, I create and load my Record (my DB is empty, so this
should give me a default object):
<cffunction name="GetAsset" access="Public" returntype="void"
output="false" hint="I return a single Asset.">
        <cfargument name="event" type="ModelGlue.Core.Event"
required="true">
        <cfset var asset = variables.reactor.createRecord("Asset") />
        <cfset var assetID = arguments.event.getValue("assetID",0) />
        <cfset asset.setAssetID(assetID) />
        <cfset asset.load() />
        <cfset arguments.event.setValue("asset",asset) />
</cffunction>

And then in my View I have this code:

<cfset asset = viewState.getValue("asset") />
<cfset regionIterator = asset.getRegionIterator() />

All the standard Record methods (getAssetID() etc.) work just fine,
and I've got two hasOne relationships that properly return Record
objects, so it's just the getXyzIterator() methods that are giving an
error - do they require that there is data present already? This would
make it hard to add new records. :) Strange that just trying to access
the Iterator gives an error...

Thanks!
 - Ken

On 2/21/06, Ken Dunnington <[EMAIL PROTECTED]> wrote:
> I'm trying to get the hang of iterators and I got an error trying to
> cfdump them. Here's the error:
>
> Message:        Element LINK.XMLATTRIBUTES.NAME is undefined in
RELATIONSHIP.
> Tag Context :
>
> /dev/Reactor/core/object.cfc (67)
> /dev/Reactor/core/objectTranslator.cfc (23)
> /dev/Reactor/core/objectFactory.cfc (87)
> /dev/Reactor/reactorFactory.cfc (40)
> /dev/Reactor/base/abstractMetadata.cfc (174)
> /dev/Reactor/query/object.cfc (146)
> /dev/Reactor/query/query.cfc (109)
> /dev/Reactor/iterator/iterator.cfc (28)
> etc.
>
> Not that big a deal, since I can just look at the code, but my REAL
> question is this:
> I have 2 objects related through a link table, using the <link
> name="LTName" /> setting in Reactor.xml, and in my Record object, I
> get two iterators, one for the second half of the relationship, and
> one for the link table itself. Is that normal? Should I just ignore
> the LT Iterator? Or am I missing the usefulness of it?
>
> Thanks,
> - Ken
>


--
 Quidquid latine dictum sit, altum sonatur.
- Whatever is said in Latin sounds profound.

 

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


Reply via email to