You don’t create bindings in WireBox, but you can create mappings. (This would be a third alternative to the other 2 alternatives I just gave)
Place the following line in your WireBox.cfc: (Also called the binder config)
map(“setupVariables”).to(“path.to.model.setupVariables”);
That tells WireBox where to find the model called “setupVariables”. Otherwise, it will go looking for it in your scan locations.
Thanks!
~Brad
By How can I map the whole of the model directory.
Well I called it a binding because it uses the binder.cfc to create the mapping.
Erik,
How many times do you need to be told, the wiki link I gave you has all the information that you need. As Brad stated, you can add the directory to the wirebox.cfc scanlocations, or you can map the one file, which he also gave you instructions on.
Or you can mapDirectory(path) which is in the wiki docs.
Seriously it’s taken how may posts, to get you to troubleshoot this?
I did the mapDirectory(“shared.model”);
But getting the error message
The DSL Definition {JAVACAST={null},NAME={bean.Body},ARGNAME={},DSL={Model},REQUIRED={false},SCOPE={variables},VALUE={null},REF={null}} did not produce any resulting dependency
The target requesting the dependency is: ‘/shared/handlers.ehGeneral’
Which basically tells me that Bean.body cannot be found. The body is located in shared/model/Bean directory
Try adding bean to the scanLocations in wireBox, as this must be a mapping you have setup ColdFusion will try to load from that directory, which means you have to add that to wirebox as well. Whether it is by the mapDirectory or scanLocations.
I did this
mapDirectory(“shared.model”);
mapDirectory(“shared.model.Bean”);
But still no luck.
When i use map directory is that only looking into direcotry, so it does not looking into the sub directory.
Can i do something like this
<cfset ModelDirectory = ExpandPath("/shared/Model") >
<cfset map("#aliasName#").to("#aliasName#")>
I think this will give me access to all the files in the Model directory
Actually I didn’t read that correctly.
The name bean.body is not right, the name needs to be the name of the CFC. So if the name if body then the the property needs to be
property name=“body” inject=“model”;
Bean is the name of the folder
What mapDirectory does is map all CFC’s by name, recursively.
When you reference these it needs to be by the name of the CFC, can you show us the property that is failing!! You can get the exact location from the logs.
But you don’t reference names with full paths, only the CFC name.
You need to understand that
property name=“bean.body” inject=“model”
Will try to find the name bean.body in the model directory, if you need it from one of the othe parts I think the DSL needs to be wirebox. Not 100% sure of that myself, but model looks in the model by conventions.
It sounds like you need to read that wiki link I sent you in a previous post with greater detail.