pseudo constructor?
I think, you mean defined as local variables to that component.
The problem is that Coldfusion 8, has to reset that instantiation for
mappings and custom tags each and every time the application.cfc is
instantiated. By placing these in the onApplicationScope, means that they
are no longer available the next time the Application.cfc is created.
Hence by placing them in the local variables for the component, and that
would be the this scope, allows for that re initialisation of the variables
each and every time. I don't like that idea, but there is a valid reason for
it to be this way.
The reason it complains when it gets to the line
CreateObject('component','components.security')>
Means that you have set them to the Application scope, and not the this
scope. So the mapping and directory components doesn't actually exist as far
as Coldfusion is concerned.
Hope that makes more sense.
Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613 9015 8628
Mobile: 0404 998 273
-----Original Message-----
From: Adam Haskell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 29 April 2008 8:43 AM
To: CF-Talk
Subject: Re: APPLICATION scope unknown in Application.cfc
Oh I forgot... this.mappings is only going to work in the psuedo
constructor.
Adam
On Mon, Apr 28, 2008 at 6:05 PM, marc -- <[EMAIL PROTECTED]> wrote:
> Hi Brian,
> You're right, I put the question wrong. Sorry about that.
> The issue is this:
> if I define 2 mappings like this
>
> <cfset THIS.mappings={}>
> <cfset THIS.mappings["/components"]="D:\www\components">
> <cfset THIS.mappings["/includes"]="D:\www\includes">
>
> outside onApplicationstart() but inside the constructor area and I later
> use them with CreateObject() the components are instantiated correctly.
> But if I put those 3 lines inside the onApplicationStart() and use
> APPLICATION.mappings instead of THIS.mappings like this:
>
> <cffunction name="onApplicationStart">
> <cfset APPLICATION.mappings={}>
> <cfset APPLICATION.mappings["/components"]="D:\www\components">
> <cfset APPLICATION.mappings["/includes"]="D:\www\includes">
> <cfset APPLICATION.objects = {}>
> <cfset APPLICATION.objects.security =
> CreateObject('component','components.security')>
>
> I get the errormessage
>
> "Could not find the ColdFusion Component or Interface
> components.security."
>
> when the line with CreateObject() is read. That line processed OK when
> using the 1st method. I wonder why this is. Do mappings have to be stored
in
> the THIS scope of Application.cfc?
>
> Marc
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304380
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4