| Package: machii_info_sample.model.category |
| I am a data gateway to categories |
| Method Summary | |
|---|---|
| public categoryGateway |
init(string dsn)
I initialize the category gateway. |
| public query |
findAll()
I return a query containing all categories |
| Method Detail |
|---|
| findAll |
|---|
public query findAll( )
I return a query containing all categories
Parameters:
Code:
<cffunction name="findAll" access="public" returntype="query" output="false" displayname="Find All" hint="I return a query containing all categories"> <cfset var qrySelect = 0 /> <cfquery name="qrySelect" datasource="#variables.dsn#"> SELECT c.*, (SELECT count(*) FROM faqs WHERE categoryID = c.categoryID AND faqs.datePublished is not NULL ) as numFaqs FROM categories c ORDER BY sortOrder </cfquery> <cfreturn qrySelect /> </cffunction>
| init |
|---|
public categoryGateway init( string dsn )
I initialize the category gateway.
Parameters:
| string dsn |
Code:
<cffunction name="init" access="public" returntype="machii_info_sample.model.category.categoryGateway" output="false" displayname="Gateway Constructor" hint="I initialize the category gateway."> <cfargument name="dsn" type="string" required="yes" displayname="Data Source Name" hint="I am the data source name." /> <cfset variables.dsn = arguments.dsn /> <cfreturn this /> </cffunction>