http://coldfusion.com logo
#box-products
Title
# box-products
d

Daniel Mejia

06/03/2022, 6:49 PM
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

bdw429s

06/03/2022, 6:54 PM
@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

gpickin

06/03/2022, 6:59 PM
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

Daniel Mejia

06/03/2022, 7:00 PM
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

gpickin

06/03/2022, 7:00 PM
we should make a video about this, but we probably need a 2022 version, this is 6 years old now @bdw429s
b

bdw429s

06/03/2022, 7:00 PM
Oooh, it was ortus dev week!
d

Daniel Mejia

06/03/2022, 7:00 PM
Thank you fellas. I'm go through that repo.
b

bdw429s

06/03/2022, 7:01 PM
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

gpickin

06/03/2022, 7:01 PM
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

bdw429s

06/03/2022, 7:02 PM
ahh yes, that's the one I wanted-- it doesn't use coldbox
d

Daniel Mejia

06/03/2022, 7:03 PM
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

bdw429s

06/03/2022, 11:43 PM
@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

Daniel Mejia

06/03/2022, 11:45 PM
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

bdw429s

06/03/2022, 11:50 PM
👍