Reputation: 1977
I have a group of CFC's that I access from two seperate Applicaiton scopes.
One /Application.cfc is in the Root.
The other Application is in /Admin/Application.cfc The cfcs are in in /_cfc/
If I call a cfc (using createObject())from a page in (for example) /Admin/members/edit.cfm, does this cfc get it's Application scope from:
Application 1: /Application.cfc
or
Application 2: /Admin/Application.cfc
The calling page is under Application 2, but the CFC itself is under Application 1.
I hope I am making sense.
Thanks
Jason
Upvotes: 5
Views: 477
Reputation: 2178
Scopes are dependant on the context in which a cfc is instantiated and not its physical location.
So given your example a cfc that lives under Application1 instantiated from a template in Application2 will see the application scope from Application2
Upvotes: 12
Reputation: 4758
Application is dependant on the name. Thus if I had two applications with different names, thats 2 sets of application scope variables.
The name of the application is normally defined like this
<cfcomponent>
<cfset this.name = 'myApplication' />
....
Upvotes: 0