Hi Doug,

I have tried the reset function, but without succes. It also is not the
session problem, because I have logged out, cleared the session, and
restarted the server, all without luck.

Some more info on this problem, it is getting weirder:

- I have the following code in my xml file:

                <object name="user">
                        <hasMany name="newsletter">
                                <link name="user_newsletter" from="user"
to="newsletter" />
                        </hasMany>
                </object>
                <object name="newsletter">
                        <hasMany name="user">
                                <link name="user_newsletter" from="user"
to="newsletter" />
                        </hasMany>
                </object>
                <object name="user_newsletter">
                        <hasOne name="user">
                                <relate from="userID" to="userID" />
                        </hasOne>
                        <hasOne name="newsletter">
                                <relate from="newsletterID"
to="newsletterID" />
                        </hasOne>
                </object>

In my userrecord, I can see a user_newsletteriterator, and a
newsletteriterator. I am trying to use the newsletteriterator, but without
luck. Then I noticed that, when the newsletteriterator.getquery() returns 0
record, the user_newsletteriterator.getquery() returns the expected 3 rows.

So I rewrote my code, to use the other iterator. But all of a sudden, the
newsletteriterator is filled with the correct 3 record, and the
user_newsletteriterator is now empty. I keeps shifting the data between the
two iterators, while to my knowledge, these two should be the same. The same
three records that is, other data of course.

So I am slowly getting crazy over this. How can this be?

Reset does not seem to help either...

Kind regards,

Erik-Jan

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
Doug Hughes
Verzonden: zondag 30 april 2006 12:58
Aan: [email protected]
Onderwerp: RE: [Reactor For CF] Strange behaviour

My guess would be that the newsletters were added after the first time you
called the getNewsletterIterator method.  If you're storing the user record
in the session then its instance data sticks around for the life of the
user's session.  This means that if you called getNewsletterIterator that
the resulting iterator is also cached in the session.  If you called
getQuery the data was then cached in the session.

The easiest solution would probably be to call reset on the iterator before
calling getQuery.  Give that a shot and see what happens.

The other thing I've noticed by having records in the session is if you
change the object the changes don't show up in the object.  You have to log
our or otherwise clear you session to see the updates.

Doug

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Erik-Jan Jaquet
Sent: Sunday, April 30, 2006 4:14 AM
To: [email protected]
Subject: [Reactor For CF] Strange behaviour

Hi all,

I am still working on the app with Model-Glue and Reactor, and I am
wondering if someone could explain why i get a certain behaviour.

I copied the security setup from Doug's Blog example. I now have a user that
can log in, that works like a charm. But I have added a relationship to that
user, a user now hasmany newsletters.

I have the userrecord available in my view at all times, so I thought I
could just call the newsletter_iterator at all times, to see which
newsletters the user subscribed to.

But the strange thing is, when I call the iterator, it returns an empty
query. At first I thought it had something to do with my setup, but when I
run the code on a test page, without Model-Glue, it works fine! I get a
query with 3 records, which is what I expected.

I checked the userid in ModelGlue, it returns the correct user, so the
record is loaded with the correct user. 

But why is the newsletter_iterator coming up with no newsletters then? Can
anyone tell me if this is expected behaviour, while working with Model Glue,
or am I missing something?

Kind regards,

Erik-Jan



 

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


Reply via email to