Re: Project not being returned as type project?
That was it. It didn't occur to me that I would need to reference the folder name. Thanks Joelle Matt Williams wrote: What does the component that has newProjectCreated() have for an argument? If its type is simply Project, then it must be in the same directory as the Project.cfc. Otherwise you may have to do ttComponents.Project for the argument type. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239808 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Project not being returned as type project?
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. TypeProject arg THISPROJECT functionNamenewProjectCreated typeProject (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
Re: Project not being returned as type project?
In the Project.cfc init function, change return type to Project. Then add cfreturn this ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239703 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Project not being returned as type project?
I did that: cffunction name=init access=public output=true returntype=Project 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# cfreturn this /cffunction and this: (ProjectHome.cfc) cfinvoke component=ttComponents.Project method=init argumentcollection=#args# returnvariable=myProject And I'm still getting the error: 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. Could it be something else? Joelle Matt Williams wrote: In the Project.cfc init function, change return type to Project. Then add cfreturn this ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239711 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Project not being returned as type project?
What does the component that has newProjectCreated() have for an argument? If its type is simply Project, then it must be in the same directory as the Project.cfc. Otherwise you may have to do ttComponents.Project for the argument type. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239728 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