i believe you'd need a <cfinvoke> for your init() method.
so you need to insert <cfinvoke> before the one you have listed.
<cfinvoke component="gateway" method="init" dsn="#application.dsn#" />
just out of curiousity...any reason you want <cfobject> over the
createObject() way? I'm sure when it all boils down you'll have 6 of
1, half-dozen of the other...but at the very least, the createObject()
allows the method chaining so it's easier to invoke the init() when
you first instantiate your CFC.
I've also read (I think Sean C. said it) that the method chaining
syntax is a little "tighter" as it prevents any race condition issues
that may arise (especially if you're creating your CFC into the
application scope).
On 10/26/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> I have been creating and invoking my CFCs like such:
>
> <cfset gateway = createObject("component",
> "appName.path.cfc").init(application.dsn) />
> <cfset qRecordset = gateway.getRecords() />
>
> But I am considering using <cfobject> instead. Here is a comparison:
>
> <cfobject name="gateway" component="appName.path.cfc">
> <cfinvoke component="gateway" method="getRecords" returnvariable="qRecordset">
>
> The only problem is that I don't know how to pass the datasource name
> to the init function upon creating the object using <cfobject>.
>
> What am I missing? Any help would be appreciated.
>
> Thanks,
> Aaron
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258133
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4