I'm working on a small application to learn cf and oop and I've got a 
problem with an object not being the type of object it's supposed to be.

I've got Project.cfc
<cfcomponent name="Project"   output="true" hint="contains needed 
information for a project">
....
    <cffunction name="init" access="public" output="true" 
returntype="void" hint="function to instantiate the class">
        <cfargument name="projectID" type="numeric" required="true" 
hint="projectID">
        <cfargument  name="title" type="string" required="true" 
hint="Title of this project as given when created">
       
        <cfset this.projectID="#arguments.projectID#">
        <cfset this.title="#arguments.title#">
    </cffunction>

In ProjectHome.cfc I've got a function create that has a lot of stuff in 
it, but in short...
    <cffunction name="create" returntype="Project" output="true" 
access="public" description="static method to create a new project">
            <cfargument name="title" type="string" hint="Title of the 
project to be created">

            <cfobject name="myProject" component="ttComponents.Project">
            <cfinvoke component="#myProject#" method="init" 
argumentcollection="#args#" >

            <cfreturn myProject>
        </cfif>

    </cffunction>

And then I call it like this:

<cfinvoke component="#application.ProjectHome#" method="create" 
title="#Arguments.title#" returnvariable="thisProject"></cfinvoke>


And in the very next line I have this:
<cfinvoke component="#Application.Messages.Project#" 
method="newProjectCreated" thisProject="#thisProject#"
                            returnvariable="session.message"></cfinvoke>


But I get this error message:
Detail  If the component name is specified as a type of this argument, 
the reason for this error might be that a definition file for such 
component cannot be found or is not accessible.
Message         The argument THISPROJECT passed to function newProjectCreated() 
is not of type Project.

Type    Project
arg     THISPROJECT
functionName    newProjectCreated
type    Project


(I can include the stack traceif that would be helpful)

I did a dump of #thisProject# right before the "newProjectCreated" line 
and the component is as it should be.

Why does the #Application.Messages.Project.newProjectCreated" method not 
know that #thisProject# is a Project?

Thanks
Joelle

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239688
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to