[coldBox 5+] using model outside CB

what is the best practice to call a CB function defined in a model from outside?

I have a legacy application that include a CB application where I defined a few functionalities in service .cfc

The need is to call this function from the legacy code.

any suggestion?

kind regards

In general, you may need to write an adapter/wrapper for your Service.cfc. Providing code sample of the CFC and how you wanna call from legacy app might help better understanding of the problem.

You should be able to access wirebox from your legacy application (using application.wirebox) and retrieve the service instance.

Brad Wood recently gave a presentation at IntoTheBox2020 on combining legacy and coldbox application.

You can find an example of this at https://github.com/bdw429s/coldbox-legacy-app-demo.

You can also look at this specific line of code to solve your problem. https://github.com/bdw429s/coldbox-legacy-app-demo/blob/89fad34b17ca324047d0a7d25dab1617ec166a52/index.cfm#L6