任何人有任何想法如何解决这个问题?Coldfusion 10调用cfc错误
"Unable to invoke CFC - The value returned from the getAllContacts function is not of type Contacts[].
如果组件名称被指定为返回类型,有可能,要么对组件的定义文件无法找到或无法访问。”
谢谢。
[ UPDATE]
没问题:这是内ContactsService.cfc代码:
<cfcomponent output="false">
<!--- [irrelevant code removed] --->
<cffunction name="getAllContacts" returntype="Contacts[]" access="remote">
<cfreturn entityload("Contacts") />
</cffunction>
<!--- [irrelevant code removed] --->
内Contacts.cfc 和代码:
<cfcomponent persistent="true" table="Contacts" output="false">
<cfproperty name="id" column="id" type="numeric" ormtype="int" fieldtype="id" />
<cfproperty name="company" column="company" type="string" ormtype="string" />
<cfproperty name="Sub_Heading" column="Sub_Heading" type="string" ormtype="string"/>
<cfproperty name="Department" column="Department" type="numeric" ormtype="int" />
<cfproperty name="boss" column="boss" type="string" ormtype="string" />
<cfproperty name="Room" column="Room" type="string" ormtype="string" />
<cfproperty name="Phone" column="Phone" type="string" ormtype="string" />
</cfcomponent>
我已经把你的代码从我的答案中拿出来,并将它弹出到你的问题中(这是它所属的地方)。 –
我会把'returntype'带走,或者只是将它设置为'array',并且每天调用它。要验证数组是否仅包含该类型,要求相当高。问题解决了。 – Henry
没有真正的“问题解决”@Henry:代码应该按原样工作,所以这里肯定有一些东西,只是掩盖当前的错误会导致有问题的情况在调用代码中冒出来,这对任何人都没有帮助。 –