Calling model from Coldbox enabled application to legacy app

Hello Everyone,

We are migrating legacy application to ColdBox framework based application. As part of migration we need to move part of code in ColdBox application which will run under different domain and site. We have legacy application structure is like ColdBox model where all components store under CFC folder and have gateway, DAO and bean.

We want to move one by one CFC from legacy to ColdBox app and move under models but we still want to utilize Models cfc under legacy app (probably using standalone wirebox).

Here is structure of Legacy App

Root
---- Secure
---- Public
---- CFC
---- index.cfm

Where secure, public contains cfm page and CFC contains all Components.

While we move to coldbox we also convert component to use inbuild wirebox and may look like below where datasource is injected from setting.

Issue is we want to use same PHOTOSERVER from legacy app and which I assume I can do with stanalone Wirebox but somehow I am not able to connect it.

Is there any guideline how to use it?

Thanks,
Pritesh

In \config\WireBox.cfc, create mappings for your legacy components. So, you can use them right away in your ColdBox app.

mapPath("legacy.CFC.PhotoService");

After you move component to /models, adjust the mapping.

mapPath("models.PhotoService");

See also: https://wirebox.ortusbooks.com/content/mapping_dsl/mapping_destinations.html

Wirebox is available on handlers and views, but on in models. To access Wirebox in models, add the following:

property name="wireBox" inject="WireBox";

See also: https://wirebox.ortusbooks.com/content/

Hi,
I had that idea but the only issue is when I am transferring to Coldbox model I want to use coldbox setting as DSL which may start with “coldbox:datasource:mydsn” but as this will not able to map through Wirebox of legacy system it gives an error.

Anyway, I found a solution by using CustomDSL to override coldbox setting and add into a legacy project and that will work for all other DSL as well.

Thanks for your help though.

Thanks
Pritesh