I’m trying to get wirebox to use models from an external location. I was able to get this working fine in development, but have an odd problem on production server.
The location of the folder I need to map to has periods in one of the folder names. Having these periods seems to resdult in coldbox treating the path as relative, and converts the periods to forwared slashes.
> The scanlocation is not absolute, it is relative to the root of the application setting the scan location.
Correct. Just like the handlers convention, views convention, or layouts convention; the model convention is the location within the web root that you will be putting models. You can add as many additional scan locations to your WireBox.cfc. The model convention is only for folders inside the webroot. Anything else needs to go in the WireBox.cfc’s scanlocations
> the periods in the folder name have been converted to forward slashes.
I don’t think your issues are just with WireBox. ColdFusion in general won’t handle that very well since periods are a special delimiter in component paths. There’s an assumption that you’ll never have periods in paths because that just won’t work.
The solution is simply to create a ColdFusion mapping in your Application.cfc that points to some place south of the “bad” folder.
in my Coldbox.cfc, but wirebox didn’t seem to detect that. Do I need to actually have a Wirebox.cfc and declare it in that, or should the declaration in Coldbox.cfc. be sufficent?
The reason the model convention has to be in the web root is because ColdBox appends it to the path to the root of the site to manually “expand” it. Look at lines 347 and 348 of coldbox/system/web/config/ApplicationLoader.cfc in ColdBox 4:
> Do I need to actually have a Wirebox.cfc and declare it in that, or should the declaration in Coldbox.cfc. be sufficent?
You need to have a config/WireBox.cfc. Unlike other libraries like LogBox where the entire config can just be shoe-horned into config/ColdBox.cfc, the WireBox binder config is a bit special and needs to be it’s own CFC so it can inherit the DSL mapping functions from its superclass.
There is an optional “wirebox” struct in your ColdBox config, but it’s only two valid keys are “binder” and “singletonReload”.