5

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

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Jason
  • 1,957
  • 2
  • 20
  • 34

2 Answers2

12

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

Chris Blackwell
  • 2,138
  • 17
  • 22
0

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' />
    ....
Dale Fraser
  • 4,623
  • 7
  • 39
  • 76
  • Thanks Dale. They both have different application names. That part is fine. I'm just wanting to confirm if a CFC get's it's application scope from the Application it physically sits under, or from the page that invoked it. – Jason Apr 02 '12 at 07:12