I know I've heard about a tutorial for using wireb...
# box-products
d
I know I've heard about a tutorial for using wirebox with legacy apps (non coldbox apps), but I can't find it in the docs, youtube, cfcasts nor at ortussolutions.com. I even tried here on slack, but maybe those conversations have been archived.
b
@Daniel Mejia Just create wirebox in the your onApplicationStart and then you'll have
application.wirebox
available anywhere
@gpickin Do you remember where the repo is we used years ago at ITB when we had the session where we took a legacy app and added all the standalone libs to it?
We had a branch for each one-- logbox, cachebox, wirebox, etc
I can't find that repo anywhere
g
I have it, its in my account. please hold
there are different branches are we implement more and more things
it's a cool approach
d
I used a mapping instead, this legacy doesn't even use Application.cfc - it still uses application.cfm and its swamped with tons of code. so that repo will be nice to go through
g
we should make a video about this, but we probably need a 2022 version, this is 6 years old now @bdw429s
b
Oooh, it was ortus dev week!
d
Thank you fellas. I'm go through that repo.
b
I even searched your repos for it, but i was seraching for "itb", "legacy", and "demo"
I remember now, it was called "meet the family"! 😆
g
meet the family was the name
i think we did it at ITB as well
the first ITB
in your github repos lol
😂 1
this was a legacy app 🙂
b
ahh yes, that's the one I wanted-- it doesn't use coldbox
d
yes thats the one I need
without coldbox
wirebox is configured (yay) to application scope, and I have scanLocations set in my wirebox config cfc. So how do I tell wirebox to scan nested models folders? I would like to be able to
box install hyper
and
box install jwt-cfml
in my modules folder then get an instance like so:
Copy code
var hyper = application.wirebox.getInstance('HyperBuilder@Hyper');
I've tried
Copy code
scanLocation = [ '**/models' ];
but didn't work.
I got it working with
Copy code
application.wirebox.getInstance('modules.hyper.models.HyperBuilder');
I realized the
HyperBuilder@hyper
is probably only for coldbox.
b
@Daniel Mejia scan locations are not the same as a mapped directory
With scan locations, they work like handlers, or views where you have to use the FULL PATH starting in the root of the folder when you inject it
if you want all CFCs recursivley mapped in all subdirs, you want your wirebox config to do
Copy code
mapDirectory( 'models' )
which is what happens in ColdBox for modules' models dir
d
ok I'll try that
ok sweet. so in my config I did
binder.mapDirectory('modules');
and to get an instance I did
application.wirebox.getInstance('HyperBuilder');
thanks
b
👍