Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

The 'argumentname' argument passed to the 'Methodename 'function is not of type 'Dto name'

New Here ,
Aug 03, 2011 Aug 03, 2011

Hi, there!

Sr for that question, because it should be pretty easy to answer, but i'm totally new to coldfusion

and googled for about an hour now. I have a orm DTO.cfc:

<cfcomponent entityname="testDTO" persistent="true" table="test"  schema="informix" output="false">
    <!---- properties ----> 
</cfcomponent>

and have a service Methode in test.cfc

    <!---- Add test---->
    <cffunction name="createTest" returntype="testDTO" access="remote">
        <cfargument name="item" type="testDTO" required="true" />
        <!---- Auto-generated method
          Insert a new record in test---->
        <cfset entitysave(item) />
        <!---- return created item ---->
        <cfreturn item/>
    </cffunction>

i try to call via the the <cfInvoke>-Tag

<cfset lieferant = entityNew('test')>

<cfinvoke
    component="#request.componentbase#.test"
    method="createTest"
    item="#test#"
    returnvariable="test">

but the error

'The ITEM argument passed to the createLieferant function is not of type testDTO.'
appears on function call. I just can't find a way to tell cf that lieferant is of type testDTO.
When i type the methodes parameter to struct the methode call works well.

Thanks for your help in advance!
Florian
801
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 03, 2011 Aug 03, 2011

Hi NewFlo,

Though i have not worked with ORM, but it seems error is not related to ORM. It is simply type mismatch.

The value you are passing to the function "createTest" is not a object of "testDTO".

I think the problem is your calling, you are providing wrong value for "item" which should be object of "testDTO".

Thanks

Saurav

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 03, 2011 Aug 03, 2011

Thx for your reply.

But you got me wrong on the problem i have.

I understand what the error wants to tell me, but i don't

know why the error happens.

I create a variable using the entity Method, passing the class name testDTO

<cfset test = entitynew("testDTO")>

In my opinion the should result in the variable set to type testDTO.

Wenn i dump the variable it also shows this class name as header of the structure.

But when i try to pass the var to the methode the error appears.

I also tried the createObject-Methode resulting in the same error.

all the best,

florian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 03, 2011 Aug 03, 2011

I'm assuming your extract there isn't quite right:

<cfset lieferant = entityNew('test')>

<cfinvoke
    component="#request.componentbase#.test"
    method="createTest"
    item="#test#"
    returnvariable="test">

You're doing item="#test#", surely this should be item="#lieferant#"?

In which case, you've done  <cfset lieferant = entityNew('test')>, which is of type "test", not "testDTO"?

If you're still having trouble, remove the item="" attribute from CFINVOKE and use CFINVOKEARGUMENTs instead.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 04, 2011 Aug 04, 2011

@Owain

You are right, sorry for that i was in a hurry and made a mistake changing my var names for the example.

I will give the CFINVOKEARGUMENTs a try as soon as i find time to play around with the orm feature

again. Thx for your reply!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2011 Aug 04, 2011
LATEST

From the example you've given, the type is DTO(name of CFC), not testDTO.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources