I created a few utility components such as randomString, randomPassword etc… which I placed under /includes/helpers/utils directory. I wanted to call the randomString component in a service called UserSVC by injection, like so:
// Dependency Injection
property name=“dao” inject=“models.rrm.UserDAO”;
property name=“gw” inject=“models.rrm.UsersGW”;
property name=“rString” inject=“includes.helpers.utils.RandomString”;
property name=“log” inject=“logbox:logger:{this}”;
property name=“populator” inject=“wirebox:populator”;
property name=“wirebox” inject=“wirebox”;
function init(){
return this;
}
with the method in the UserSVC component like this:
// Return a random string as the default user account screen name
public string function randomString(required numeric length) {
return rString.RandomString(arguments.length);
}
But I get an error message: method randomString is undefined in UserSVC.
Question: Should all invoked business components be considered part of the model and therefore be located under the “models” directory instead of any other directory such as “includes” for them to be recognised by ColdBox? Or should I create a mapping in Wirebox?