Skip to content

Instantly share code, notes, and snippets.

@iknowkungfoo
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iknowkungfoo/9082836 to your computer and use it in GitHub Desktop.
Save iknowkungfoo/9082836 to your computer and use it in GitHub Desktop.
A parent CFC uses implicit getters and setters with the property "data". A child CFC extends the parent with a defined setter for "data", which calls super.setData(). setData() is not found.
<!--- Child CFC, extends Parent --->
<cfcomponent displayName="ChildTag" output="false" accessors="true" extends="ParentTag">
<cfproperty name="wibble" type="string" required="true" />
<cffunction name="setData" output="false" returntype="void">
<cfargument name="data" type="string" required="true" />
<cfset super.setData(arguments.data & " via Child.") />
</cffunction>
</cfcomponent>
<!--- Parent CFC --->
<cfcomponent displayname="ParentTag" output="false" accessors="true">
<cfproperty name="data" type="string" required="true" />
<cfproperty name="foo" type="string" required="true" />
</cfcomponent>
The setData method was not found.
Either there are no methods with the specified method name and argument types or the setData method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
The error occurred in /ChildTag.cfc: line 8
<cffunction name="setData" output="false" returntype="void">
<cfargument name="data" type="string" required="true" />
<cfset super.setData(arguments.data & " via Child.") />
</cffunction>
<h2>Child Tag CFC</h2>
<cfset x = new ChildTag() />
<cfset x.setData("My Data.") />
<cfset x.setFoo("My Foo.") />
<cfset x.setWibble("My Wibble") />
<cfoutput>
Data: #x.getData()#
<br/>
Foo: #x.getFoo()#
<br />
Wibble: #x.getWibble()#
</cfoutput>
<h2>Parent Tag CFC</h2>
<cfset x = new ParentTag() />
<cfset x.setData("My data.") />
<cfset x.setFoo("My Foo.") />
<cfoutput>
#x.getData()#
<br/>
#x.getFoo()#
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment