I left out a major detail I am using Reactor in Model-Glue Unity.
On 4/11/07, Chris Blackwell <[EMAIL PROTECTED]> wrote:
I believe you can shorten that a bit newIteratorItem = user.getRolesIterator().add() newIteratorItem.load(RoleId=??) user.save() > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of jonah.blossom > Sent: 11 April 2007 19:56 > To: [EMAIL PROTECTED] > Subject: Re: [Reactor for CF] Reactor question Relationships > via Linking Tables > > Matt, > > Here's how I do it: > > <cfscript> > user.getRolesIterator().add(); // Adds a new empty item > to the end > of the array in the iterator. > newIteratorItem = > user.getRolesIterator().getAt(user.getRolesIterator().getRecor > dCount()); > // Gets that newly added item from the iterator > newIteratorItem.setID(roleID); // Sets the ID of the new role you > you want to associate. (If you're creating a new role instead, simply > set the name, etc. and then don't do load.) > newIteratorItem.load(); // Loads the role information from the DB. > user.save(); // Persists the user and it's newly added role. > </cfscript> > > Matt Graf wrote: > > > > I am looking at the livedocs and I am unclear on how to use reactor > > when I have relationships via linking table. I know how to get the > > data out but how do I insert the data into the linking table? > > > > Here is my reactor script > > > > <object name="user"> > > <hasMany name="roles"> > > <link name="userroles" /> > > </hasMany> > > </object> > > > > <object name="roles"> > > <hasMany name="user"> > > <link name="userroles" /> > > </hasMany> > > </object> > > > > <object name=" userroles "> > > <hasOne name="user"> > > <relate from="userId" to="userId" /> > > </hasOne> > > <hasOne name="roles"> > > <relate from="roleId" to="roleId" /> > > </hasOne> > > </object> > > > > > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > -- -- -- > > -- -- -- -- > > 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/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [EMAIL PROTECTED] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
