Maybe I missed something but I was unable to autowire a model file
unless the model file had the same name as the returntype of the init
method. I am using CB3 M4
What I tried to do was create a mapping
addModelMapping(alias='notifyService',path="notify");
then in the model file I had
notify.cfc
<cfcomponent name="notifyService" displayname="notifyService"
output="true">
<--- Dependencies --->
<cfproperty name="notifyDSN" type="coldbox:datasource:notifyDSN"
scope="instance" />
<cfscript>
instance = structnew();
</cfscript>
<cffunction name="init" output="false" returntype="notifyService">
<cfreturn this>
</cffunction>
..........
The handler
ehNotify.cfc
<cfcomponent extends="coldbox.system.EventHandler" output="false"
displayname="ehNotify" autowire="true">
<--- Dependencies --->
<cfproperty name="notifyService" type="model" scope="instance" />
So When I reinited the framework I would get the following error:
"Error Type: Autowire.AutowireException : [N/A]
Error Messages: Error autowiring handlers.ehNotify. The value returned
from the init function is not of type notify. If the component name is
specified as a return type, its possible that a definition file for
the component cannot be found or is not accessible."
So not sure why this is happening for the moment I renamed the file to
match instance.
thanks
Kevin