Created
February 23, 2012 20:34
-
-
Save tdm00/1894909 to your computer and use it in GitHub Desktop.
Single Table Inheritance & Nested Properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="Model" output="false"> | |
<cfset this.modelName = ListLast(GetMetaData(this).name, ".")> | |
<cffunction name="init"> | |
<!--- Model Validations ---> | |
<cfset validatesPresenceOf(properties="callstatusid") /> | |
<!--- Associations ---> | |
<cfset hasMany(name="taggings", dependent="deleteAll", shortcut="tags") /> | |
<cfset nestedProperties(associations="callnotes,taggings", allowDelete=true) /> | |
</cffunction> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="Call" output="false"> | |
<cfset this.modelName = ListLast(GetMetaData(this).name, ".")> | |
<cffunction name="init"> | |
<!--- Model Validations ---> | |
<cfset table(name="calls")> | |
<cfset validatesPresenceOf(properties="patientname") /> | |
<cfset super.init()> | |
</cffunction> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="Model" output="false"> | |
<cffunction name="init"> | |
<!--- Properties ---> | |
<!--- Validations ---> | |
<cfset validatesPresenceOf(properties="name")> | |
<!--- Associations ---> | |
<cfset hasMany(name="taggings", shortcut="calls") /> | |
</cffunction> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="Model" output="false"> | |
<cffunction name="init"> | |
<!--- Properties ---> | |
<!--- Validations ---> | |
<!--- Associations ---> | |
<cfset belongsTo("call") /> | |
<cfset belongsTo("tag") /> | |
<cfset belongsTo( | |
name="requisitioncall", | |
modelName="requisitioncall", | |
foreignKey="objectId") /> | |
</cffunction> | |
</cfcomponent> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment