Absolutely. WireBox will let you do whatever you want in your models.
The models folder is essentially the default convention folder for your CFCs, just like handlers and views are the default convention folders for controllers and rendered output. In WireBox, we call the models convention folder the “scan location”. WireBox can have unlimited scan locations-- “models” is just the default. You can also create subdirectories inside of the models directory or create entirely new directories in your web root (or out of it).
If you are using explicit mappings in your WireBox.cfc binder config like so:
map(“user”).to(“domain.user”);
map(“userService”).to(“model.userService”);
Then you are done! Explicit mappings don’t bother with scan locations and simply resolve the full component path with ColdFusion’s mappings.
getModel(“user”)
getModel(“userService”)
If you are using mapDirectory like so:
mapDirectory(“model”)
mapDirectory(“domain”);
Then you are also good. This is the same as the explicit mappings, and recursively scans the folder and creates mappings based on the CFC name (which can be overridden with metadata inside the CFC).
getModel(“user”)
getModel(“userService”)
If you are using scan locations, that means you have not added any mappings in your WireBox.cfc binder config and you are asking for the models using a path relative to one of your scan location folders. Since userService is in the root of the models directory, this will still work since WireBox will scan “models.userService” looking for it:
getModel(“userService”)
To make WireBox scan your domain folder, all you need to do is add a line of code in the WireBox.cfc binder config to add the domain folder as a scan location:
scanLocations = [“models”,“domain”]
That will check for “models.user” and “domain.user” in that order.
getModel(“user”)
One note about using scan locations-- if you have a subdirectory, you must include the full path relative to the root of the scan location:
/app
/model
userService.cfc
/security
securityService.cfc
getModel(“security.securityService”)
Hope this helps. Here’s some reading for you:
http://wiki.coldbox.org/wiki/WireBox.cfm
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com