Actually. I found a way to do it.
I created a view that related the two tables in the way
I wanted and then did the following:
<cfset nbrGateway =
Reactor.CreateGateway("viewNavigationByRole") />
<cfset query = nbrGateway.createQuery() />
<cfset query.getWhere().isEqual("viewNavigationByRole","roleID","100")>
<cfset query.getWhere().setMode("or").isNull("viewNavigationByRole","roleID")>
<cfset query.getWhere().setMode("and").isEqual("viewNavigationByRole","site","1")>
<cfset query.getWhere().isEqual("viewNavigationByRole","roleID","100")>
<cfset query.getWhere().setMode("or").isNull("viewNavigationByRole","roleID")>
<cfset query.getWhere().setMode("and").isEqual("viewNavigationByRole","site","1")>
Is that the best way or was there a good way to avoid
creating the view?
Thanks,
Josh
------------------------------------------------
Joshua Scott
Resonant Media Technologies, LLC.
http://www.resonantmedia.com | http://ponderings.wordpress.com
"It is impossible to get out of a problem by using the same type of thinking that it took to get into the problem." -- Albert Einstein
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joshua Scott
Sent: Thursday, May 04, 2006 3:57 PM
To: [email protected]
Subject: [Reactor For CF] Can I do this with Reactor?
All,
Here is what I would like to do:
I have two tables that dynamically assign nav options
by role. The reactor.xml is:
<object
name="Navigation">
<hasMany name="RoleNav">
<relate from="id" to="navid" />
</hasMany>
</object>
<object name="RoleNav">
<hasOne name="Navigation">
<relate from="navid" to="id" />
</hasOne>
</object>
<hasMany name="RoleNav">
<relate from="id" to="navid" />
</hasMany>
</object>
<object name="RoleNav">
<hasOne name="Navigation">
<relate from="navid" to="id" />
</hasOne>
</object>
My navigation table has the information about that nav
the label and the even that is fired. The RoleNav table as the roles that have
access to that nav item. (More detail below.)
Basically I need to be able to load a roleID and return
the details from the navigation table to build the nav. Here is the table
structures.
Navigation Table
id int 4 (UID Primary
Key)
label nvarchar 50 (Label for the
Link)
site int 4 (Site that this Nav applies
to)
event nvarchar 50 (The model glue event that is triggered by the
link.)
RoleNav Table
id int 4 (UID Primary
Key)
navID int 4 (Related to the id
field in the Navigation table)
roleID int 4 (The role that
has access to this nav option. There can be multiple roles that have access to
the same options.)
Do I have to right a custom method or can I do this
with Reactor?
- JS
------------------------------------------------
Joshua Scott
Resonant Media Technologies, LLC.
http://www.resonantmedia.com | http://ponderings.wordpress.com
"It is impossible to get out of a problem by using the same type of thinking that it took to get into the problem." -- Albert Einstein

