Thanks for the advice! I guess I've been goofing around with some frameworks without understanding all the implications of my choices. Anwyay, I noticed that Doug uses the var scope when creating objectRecords. Sounds good to me. However, can you explain why this better than just re-initiating the variables.objectRecord in an MG controller? Is this just coding style or like you say A Big Red Flag?
Cheers,
Sam
p.s. I made the changes you recommended and I'm still getting that error. It's such a simple prototype app (on my dev machine) that I think it might be the new build. Of course, I could be wrong!
On 4/18/06, Jared Rypka-Hauer <[EMAIL PROTECTED]> wrote:
Sam,Reinit your MG application, reset the session variable, delete your Reactor project files (/Reactor/project/{project}/*.*), and, most of all, don't put a record object in the variables scope of a MG controller!!The controllers live in the application scope, so if you have variables.userRecord and that represents an actual Reactor-generated user object, you've just set that value into an application-scope container. Big Red Flag There®.If you have several users relying on that, or if you handle several requests against that at once, things are going to get alllllll screwed up.Instead, use onRequestStart() in your MG controller to set a User object into the session scope and call session.User.setCompanyId() and you'll find yourself a LOT happier over time.HTH,J
------------------------------------------------
Jared C. Rypka-Hauer
Continuum Media Group LLC
Member, Team Macromedia - ColdFusion
"That which does not kill me makes me stranger." - Yonah Schmeidler
On Apr 18, 2006, at 4:56 PM, Sam Clement wrote:Hi Doug,
Is the latest SVN code meant to be solid? If so, I've noticed a weird problem - if not, feel free to ignore the following:
I'm prototypying something pretty simple with 2 tables so far: company & user.
Here is the reactor.xml to show how they relate:
<objects>
<object name="company" />
<object name="user">
<hasOne name="company">
<relate from="companyid" to="companyid" />
</hasOne>
</object>
</objects>
Now when I try to process a form and use the method variables.userRecord.setCompanyid() in my MG controller I receive this error:
Element CHILDREN.COMPANY is undefined in VARIABLES.
D:\Webroot\reactor\project\myProject\Record\userRecord.cfc (189)
If I take out the relationship defined in the reactor.xml, the error goes away (but then so does the relationship!)
Investigating the generated userRecord.cfc, I see the following:
<!--- companyid --->
<cffunction name="setcompanyid" hint="I set the companyid value and reset related objects." access="public" output="false" returntype="void">
<cfargument name="companyid" hint="I am this record's companyid value." required="yes" type="string" />
<!--- if the value passed in is different that the current value, reset the valeus in this record --->
<cfif arguments.companyid IS NOT getcompanyid()>
<cfif variables.children.company IS NOT 0>
<cfset variables.children.company.resetParent() />
</cfif>
<cfset variables.children.company = 0 />
<cfset _getTo().companyid = arguments.companyid />
<!--- load the correct address record --->
<cfset getAddress() />
</cfif>
</cffunction>
The code in red seems to be causing the problem, though not understanding the reactor framework, I can't figure out why. Any insight would be appreciated.
Cheers,
Sam-- 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/

