PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/_assets/models/Tag.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 49 lines | 40 code | 9 blank | 0 comment | 0 complexity | c959f23ba0f151fec1f73d754ef34d9d MD5 | raw file
 1<cfcomponent extends="Model">
 2
 3	<cffunction name="init">
 4		<cfset belongsTo(name="parent", modelName="tag", foreignKey="parentid", joinType="outer")>
 5		<cfset hasMany(name="children", modelName="tag", foreignKey="parentid")>
 6		<cfset hasMany(name="classifications")>
 7		<cfset beforeSave("callbackThatReturnsTrue")>
 8		<cfset property(name="name", label="Tag name")>
 9		<cfset property(name="virtual", label="Virtual property")>
10	</cffunction>
11
12	<cffunction name="callbackThatIncreasesVariable">
13		<cfif NOT StructKeyExists(this, "callbackCount")>
14			<cfset this.callbackCount = 0>
15		</cfif>
16		<cfset this.callbackCount++>
17	</cffunction>
18
19	<cffunction name="callbackThatReturnsFalse">
20		<cfreturn false>
21	</cffunction>
22
23	<cffunction name="callbackThatReturnsTrue">
24		<cfreturn true>
25	</cffunction>
26
27	<cffunction name="callbackThatReturnsNothing">
28	</cffunction>
29
30	<cffunction name="callbackThatSetsProperty">
31		<cfset this.setByCallback = true>
32	</cffunction>
33
34	<cffunction name="firstCallback">
35		<cfif NOT StructKeyExists(this, "orderTest")>
36			<cfset this.orderTest = "">
37		</cfif>
38		<cfset this.orderTest = ListAppend(this.orderTest, "first")>
39	</cffunction>
40
41	<cffunction name="secondCallback">
42		<cfif NOT StructKeyExists(this, "orderTest")>
43			<cfset this.orderTest = "">
44		</cfif>
45		<cfset this.orderTest = ListAppend(this.orderTest, "second")>
46		<cfreturn false>
47	</cffunction>
48
49</cfcomponent>