richard
Trying not to be a rookie
Joined: 03/09/09
Posts: 17 |
DSN property won't appear in instance
03/11/10 7:57 AM
Hi all,
pretty new to dependancy injection, but am now trying to use Coldbox's autowire functionality.
My problem is specifically relating to adding a DSN property into one of my service CFCs.
I've added these details to the top of my cfc
<cfcomponent displayname="CatalogueService" output="false" cache="true" cachTimeout="0">
<!--- Dependencies --->
<cfproperty name="CatalogueGateway" type="model" scope="instance" />
<cfproperty name="DSN" type="coldbox:datasource:dsn" scope="instance" />
<cfproperty name="SessionStorage" type="coldbox:plugin:sessionstorage" scope="instance" />
<cfscript>
instance = structnew();
</cfscript>
<cffunction name="init" returntype="CatalogueService">
<cfargument name="DSN" type="string" inject="#instance.dsn.getName()#" hint="Datasource" />
<cfscript>
variables.DSN = arguments.DSN;
return this;
</cfscript>
</cffunction>
I've kept the init very similar to what I've used to use to prevent needing to change any of the code.
I was aware that coldbox 3 has standardised the name for wiring to "inject". However, I'm still on coldbox 2.6 (I think).
So to keep inline I added this line to the coldbox.cml.cfm file and <yoursettings> section
<Setting name="beanFactory_dslMarker" value="inject"/>
Unfortunately I'm receiving this error:
================= Application Execution Exception Error Type: Application : [N/A] Error Messages: The DSN parameter to the init function is required but was not passed in. =================
and can't figure out why?? Is anyone able to show me the error of my way? Thanks,
Richard
|