Frage

I am working on migrating an application to an framework application (specifically Fusebox 5.5). I would need to extend two Application.cfc [Fusebox5.Application] and another Application.cfc that sits in a folder a couple directories up. Below is the directory structure:

--WebRoot 
    --Fusebox5 <---(This is where the corefiles for Fusebox is stored)
    --Folder1 <---(This is the Application.CFC file I want to extend)
        --sub-Folder1
            --sub-subOfFolder1
                --sub-sub-subOfFolder1
                    --Application Folder (This is where the application lives)

The Application.cfc file has the following code:

<cfcomponent extends="fusebox5.Application" output="false">

It's not as simple as adding fusebox5.Application,Folder1.Application, but basically, is what I want to do. Any help would be appreciated.

Couple caveats:

  • I do NOT want to make any impact on any existing code outside of the Application folder. I read about extending an ApplicationProxy.cfc and would probably be willing to try that out, but that would be the extent of any modifications to existing code base.
  • I can consider an alternative framework, but a lot of the existing code base that I'm migrating would not lend itself very well. My primary objective would simply to be organize code.
War es hilfreich?

Lösung

Without knowing which bits from which Application.cfc you need to re-use, it's difficult to answer this.

However you cannot have multiple inheritance in CF. I guess you know this.

You could conceivably create a new CFC in your sub app which extends the one in the main app, and then create an instance of that wihthn your sup-app's Application.cfc. You can then call its public methods and access its THIS scope as needs must.

And your sub-app can then extend the Fusebox one as per normal.

Or, possibly, do it the other way around, depending on which makes more sense.

Other than that, you could refactor the bits you need from the main app into some other construct (and include file, a different CFC or something), and then call that code from each of the main-app and sub-app, and again extend Fusebox from the sub-app. Obviously this means monkeying with the main app, and regression testing again, etc.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top