Joshua, that does reset and repopulate the Iterator, but it loses its Parent's info.

Lets say I have a one to many (Foo to Widgets)

when I do a WidgetIterator().reset() (after adding your resetWhere() stuff) I return all Widgets (not just the ones related to my Foo record).

I have something similar written, but I created a new function to do it, so I could separate the behaviors..]


I think there is probably a way to manage a Reinit() or a Repopulate() etc while keeping the parent relationship.

 
AJL

On 5/16/06, Joshua Scott <[EMAIL PROTECTED]> wrote:
All,
 
It appears that the reset method is not resetting the where object properly. The following change to the iterator.cfc object seems to do the trick.
 
 <!--- reset --->
 <cffunction name="reset" access="public" hint="I reset the array and query data that backs this iterator." output="false" returntype="void">
  <cfset getQueryObject().resetWhere() /><!--- This line is added --->
  <cfset variables.query = 0 />
  <cfset variables.array = ArrayNew(1) />
  <cfset variables.index = 0 /> 
 </cffunction>
 
Let me know if this is not the proper solution, but it seems to work for me.
 
- 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
 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Joshua Scott
Sent: Tuesday, May 16, 2006 9:39 AM
To: [email protected]
Subject: RE: [Reactor For CF] Missing Iterator Method???

I had this same problem. Doug might want to error a validation error when this happens.
 
- JS
 

------------------------------------------------

Joshua Scott

Resonant Media Technologies, LLC.

www.resonantmedia.com | 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 Brad Haas
Sent: Monday, May 15, 2006 2:07 PM
To: [email protected]
Subject: Re: [Reactor For CF] Missing Iterator Method???

I'll discovered a mistake that I made. It is really simple and it caused me to waste about 6 hours, so I'll share my ignorance with the world.

In my config.xml file, I did not wrap the xml "object" tags in a parent "objects" tag. So I had something like this:

<config>
config stuff
</config>

<object>
object 1 stuff
</object>

It should be like this:

<objects>
<object>
object 1 stuff
</object>
</objects>

The funny thing is that Reactor will actually work (partially) with my initial configuration. It will generate objects like DAOs and Gateways, but you won't get Iterators. I think this is what threw me off. I thought that Reactor would either work or it wouldn't. I never thought about something in between.

I hope my mistake will prevent someone else from doing the same thing. I apologize if any of you wasted any brain cells on this one.

Thanks,
Brad


On May 15, 2006, at 12:41 PM, Brad Haas wrote:

I'm fairly new to Reactor so maybe I'm doing something wrong. Here's the scenario:

MSSQL Database
************************

===================
User
===================
UserID (PK)
Email
Password

===================
Group
===================
GroupID (PK)
GroupName
Group Description

===================
GroupMember
===================
GroupMemberID (PK)
GroupID (FK)
UserID (FK)


reactor.xml (partial)
***************************
config data
.
.
<object name="Group">
<hasMany name="User">
<link name="GroupMember" />
</hasMany>
</object>

<object name="User">
<hasMany name="Group">
<link name="GroupMember" />
</hasMany>
</object>

<object name="GroupMember">
<hasOne name="Group">
<relate from="GroupID" to="GroupID" />
</hasOne>
<hasOne name="User">
<relate from="UserID" to="UserID" />
</hasOne>
</object>

My problem is when I try to call the getGroupIterator (or any iterator):

<cfset User = Application.Reactor.createRecord("User")>
<cfset User.load(UserID=1)>
<cfset grpQry = User.getGroupIterator().getQuery()>

I get this error:

The method 'getGroupIterator' could not be found in component C:\Sites\OneStop\AppData\Record\UserRecordmssql.cfc.

When I do a dump on the User component--sure enough there is no iterator methods. Here's what I've done to try to troubleshoot the issue:

* Clear the application scope.

* Restart the server.

* Delete all the files generated by Reactor.

* Delete Reactor entirely and get the latest build from the repository.

Does anyone have any ideas what I may be doing wrong or what could be happening? I appreciate any insights.

Thanks,
Brad





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



--
Aaron Lynch
www.AaronJLynch.com
www.WorldWildWeb.biz -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/

Reply via email to