Did you find Dan Wilson's tutorials? They're pretty good...
http://www.nodans.com/page.cfm/Tutorials
On Thu, Nov 6, 2008 at 8:13 PM, bmelendy <[EMAIL PROTECTED]> wrote:
>
> Just working my first real model-glue application. The only example I
> have found is the translator program and it really doesn't cover any
> data access. What I've done is to create a view template that calls a
> CFC (model). In my debug output, I can see that my query has run and
> has 4 records, but I can't figure out how to get the records back from
> my CFC. Here's what I've done:
>
> <cfcomponent displayname="ConDAO" hint="Contact Data Access Object">
> <!--- properties --->
> <cfset variables.dsn = "" />
> <!--- init() Method --->
> <cffunction name="init" access="public" returntype="ConDAO">
> <cfargument name="dsn" type="string" required="yes" />
> <!--- initiate value(s) --->
> <cfset variables.dsn = arguments.dsn />
> <cfreturn this />
> </cffunction>
>
> <!--- READ --->
> <cffunction name="list" access="public" returntype="query"
> hint="List
> method">
> <cfquery name="ContactList" datasource="#variables.dsn#">
> SELECT id, CONCAT(fname,' ',lname) as name, email
> FROM contact
> </cfquery>
> <cfreturn ContactList />
> </cffunction>
> </cfcomponent>
>
> Then I have my template that calls the CFC:
>
> <!--- create an instance of our DAO object --->
> <cfset conList = createObject("component",
> "contact.model.ConDAO").init( DSN = "bradtest" ) />
> <!--- execute my list method that queries the database --->
> <cfset conList.list() />
> <!--- Dump output --->
> <cfoutput><cfdump var="#conList.ContactList#"></cfoutput>
>
> conList.list() executes my query and returns type query, named
> ContactList. I can see the query execute in CF Debug, and it has 4
> records, but I can't for the life of me figure out how to get at that
> data through the object. Of course I can cheat and just reference the
> name of the query, but that defeats the purpose of trying to do it the
> OOP way and use Model Glue.
>
> Thanks for any help. I've blown some time on this and just can't find
> many examples on CFOOP or Model-Glue after googling for hours. Thanks
> again.
>
> ...Brad
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---