Hi all,
I want to be able to call a service method from within the onLoad() function of my moduleConfig.
I came across this : http://wiki.coldbox.org/wiki/Modules.cfm#Interceptor_Methods:_onLoad().2C_onUnLoad().2C_etc that certainly suggests that I should be able to do this.
However, this returns that getModel() doesn’t exist.
A quick search of the google group turned up a post by Luis saying that I should be using controller.getWirebox().getInstance(“namehere”). When I try this I get :
The getFactory method was not found. |
- |
Either there are no methods with the specified method name and argument types or the getFactory method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity. |The error occurred in D:\lib\coldbox310\system\plugins\IOC.cfc: line 130
Called from D:\lib\coldbox310\system\ioc\dsl\ColdBoxDSL.cfc: line 197
Called from D:\lib\coldbox310\system\ioc\dsl\ColdBoxDSL.cfc: line 37
Called from D:\lib\coldbox310\system\ioc\Builder.cfc: line 309
Called from D:\lib\coldbox310\system\ioc\Injector.cfc: line 555
Called from D:\lib\coldbox310\system\ioc\Injector.cfc: line 462
Called from D:\lib\coldbox310\system\ioc\scopes\NoScope.cfc: line 33
Called from D:\lib\coldbox310\system\ioc\Injector.cfc: line 262
Called from D:\sites\namechanged\modules\staffboard\ModuleConfig.cfc: line 46
Called from D:\lib\coldbox310\system\web\services\ModuleService.cfc: line 321
Called from D:\lib\coldbox310\system\web\services\ModuleService.cfc: line 235
Called from D:\lib\coldbox310\system\web\services\LoaderService.cfc: line 89
Called from D:\lib\coldbox310\system\Coldbox.cfc: line 71
Called from D:\lib\coldbox310\system\Coldbox.cfc: line 102
Called from D:\sites\namechanged\www\Application.cfc: line 60 |
I also slightly naughtily tried controller.runEvent(), but that also throws a getFactory method not found, but with a different stack trace.
controller.getWirebox().containsInstance(“namehere”) returns true, suggestion I should be able to do this, but the getFactory method means nothing to me and I’m not really sure how to debug this or what other information I might be able to provide for folks to be able to help me…
Any help would be much appreciated.
Regards
Stephen