Thanks for the response and suggestions, Brian, but I tried that before and
once again now and it's not doing anything for me. I'll paste my
Reactor.xml file here for you, which may be of assistance. I also checked
something more simple, just a basic hasOne relation to say "tblUser has one
tblItems", and that doesn't work either. I would expect it to give my
tblUser object a getTblItems() method, but it doesn't. So basically it seems
like Reactor is working perfectly for all within-an-object operations (ie.
for creating TOs, DAOs, Gateways, etc, for one object), but not at all for
any relations that I express between objects, which is severely limiting.
In the copied Reactor.xml, too, you'll notice that I made the tblUser entry
more complex than it was in my first post. I had tried that simplified
version for the sake of the example, but here's what I really need to
express:
Many thanks!
<reactor>
<config>
<project value="ageconcern" />
<dsn value="ageconcern" />
<type value="mssql" />
<mapping value="/AgeConcernData" />
<mode value="development" />
</config>
<object name="tblUser">
<hasOne name="tblItems">
<relate from="intItemID" to="intItemID" />
</hasOne>
<hasMany name="tblRole">
<link name="tblUserRole" />
</hasMany>
</object>
<object name="tblRole">
<hasMany name="tblUser">
<link name="tblUserRole" />
</hasMany>
</object>
<object name="tblUserRole">
<hasOne name="tblUser">
<relate from="intUserItemID" to="intItemID" />
</hasOne>
<hasOne name="tblRole">
<relate from="intRoleID" to="intRoleID" />
</hasOne>
</object>
<object name="tblGroup">
<hasOne name="tblItems">
<relate from="intItemID" to="intItemID" />
</hasOne>
</object>
<object name="tblTag">
<hasOne name="tblItems">
<relate from="intCreatorID" to="intItemID" />
</hasOne>
<hasMany name="tblItems">
<link name="tblItemTag" />
</hasMany>
</object>
<object name="tblItems">
<hasMany name="tblTag">
<link name="tblItemTag" />
</hasMany>
</object>
<object name="tblItemTag">
<hasOne name="tblItems">
<relate from="intItemID" to="intItemID" />
</hasOne>
<hasOne name="tblTag">
<relate from="intTagID" to="intTagID" />
</hasOne>
</object>
</reactor>
On 01/12/2007, Brian Kotek <[EMAIL PROTECTED]> wrote:
>
> Have you tried deleting the generated files, purging the template cache,
> setting mode back to development, and then doing a full reload of Reactor?
>
> On Dec 1, 2007 10:48 AM, Dave Knapik < [EMAIL PROTECTED]> wrote:
>
> > Oops, sorry about that! Accidentally sent before writing part 2, so here
> > it is:
> >
> > So now that you know my table schema, here's the excerpt of Reactor.xml:
> >
> > <object name="tblUser">
> > <hasMany name="tblRole">
> > <link name="tblUserRole" />
> > </hasMany>
> > </object>
> >
> > <object name="tblRole">
> > <hasMany name="tblUser">
> > <link name="tblUserRole" />
> > </hasMany>
> > </object>
> >
> > <object name="tblUserRole">
> > <hasOne name="tblUser">
> > <relate from="intUserItemID" to="intItemID" />
> > </hasOne>
> > <hasOne name="tblRole">
> > <relate from="intRoleID" to="intRoleID" />
> > </hasOne>
> > </object>
> >
> > For some reason, this isn't working at all to generate anything. In my
> > RoleService.cfc, I pass a TblUser object to my method
> > getUserRolesByUser() like so:
> >
> > <cffunction name="init" access="public" returntype="RoleService"
> > output="false">
> > <cfargument name="ormService" type="any" required="true"
> > hint="Dependency ormService" />
> >
> > <!--- assign arguments to variables scope --->
> > <cfset variables.ormService = arguments.ormService />
> >
> > <!--- set into variables scope anything you need from the
> > ormService --->
> > <cfset variables.RoleGateway =
> > variables.ormService.createGateway("tblRole") />
> > <cfset variables.UserRoleGateway =
> > variables.ormService.createGateway("tblUserRole") />
> >
> > <cfreturn this />
> > </cffunction>
> >
> > <cffunction name="getUserRolesByUser" access="public" returntype="any"
> > output="false" hint="Given user object, returns list of roles for that
> > user.">
> > <cfargument name="objUser" type="any" required="true" />
> >
> > <cfscript>
> > var l = StructNew();
> > </cfscript>
> >
> > <cfset l.qryRoles =
> > arguments.objUser.getTblRoleIterator().getQuery()
> > />
> > <cfset l.lstUserRoles = l.qryRoles.nvcRoleTitle />
> >
> > <cfreturn l.lstUserRoles />
> > </cffunction>
> >
> > This failed, so I tried dumping my arguments.objUser and aborting
> > mid-method to see what it looked like. There is no getTblRoleIterator()
> > method, or any iterator method for that matter, anywhere on it. What gives?
> > What did I miss? Please help! Obviously it wasn't auto-generated yet, which
> > sort of brings me to my next questions..
> >
> > Although I read the Reactor docs fully, I can't seem to get a firm sense
> > of what actually reloads the framework (the reactor.xml file). Also,
> > when is the point of auto-generation of methods like getTblRoleIterator,
> > when I told my Reactor object (ormservice here, from ColdSpring) to
> > createGateway("TblRole")?
> >
> > Your help is much appreciated, because if don't sort this out soon I'll
> > have to fall back on manually creating queries that Reactor should be able
> > to do for me if only I knew how to do this properly.
> >
> > Cheers,
> > Dave
> >
> >
> > On 01/12/2007, Dave Knapik < [EMAIL PROTECTED]> wrote:
> >
> > > Hello,
> > >
> > > This is my first foray into the world of Reactor. I've been using it
> > > for about a month, and all has mostly been well, but I've come to the
> > > point
> > > where I need to implement a basic link table relationship like so (first
> > > the
> > > SQL 2000 table schema descriptions and then the reactor.xml excerpts):
> > >
> > > tblUser
> > > ____
> > > intItemID
> > > nvcFirstName
> > > nvcLastName
> > > ... more fields...
> > >
> > >
> > > tblRole
> > > ------
> > > intRoleID
> > > nvcRoleTitle
> > > nvcRoleDescription
> > > ... more fields ...
> > >
> > >
> > > tblUserRole
> > > ------
> > > intUserRoleID (my PK for the link table)
> > > intUserItemID (my FK back to tblUser.intItemID)
> > > intRoleID (my FK back to tblRole.intRoleID)
> > >
> > > There is a fourth table, tblItems, which accounts for the ropey naming
> > > conventions here, and it's just something my company uses that I can't get
> > > around (essentially a User is an Item, as are a lot of things, so
> > > tblUser.intItemID FK's back to tblItems.intItemID rather than having
> > > an auto-incrementing PK of its own).
> > >
> > >
> > >
> >
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > -- -- --
> > 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/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --