Tim,

I am not 100% sure, but I have come across this before and I think it
has to do with loading the cfc from the current directory.

Others like Sean might give a better explanation, but my fix has been
to create a mapping for core or to use /core.package.component.





On 10/11/07, Tim Ashworth <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm working on an OOP project and am having a bit of a problem with objects
> referencing each other.
>
> My folder structure is
>
> /siteRoot/
>
> /siteRoot/core (Where all my classes are)
>
> /siteRoot/core/valueObjects
>
> I'm quite early on in the build so I'm just setting up my value classes.
>
> I've got two classes in there, one called Page, the other called Head.
>
> Back at the root I'm instantiating these classes in a cfm file called
> testing.
>
> <cfset page = CreateObject("component","core.valueObjects.Page").init()>
> <cfset head =
> CreateObject("component","core.valueObjects.Head").init(title:"This is a new
> title")>
>
> So far so cool.  The problem is that one of the properties of the Page class
> is a Head object.
>
> This is populated with this function in the Page class
>
> <cffunction name="setHead" access="public" hint="Sets the Head Object">
>
>     <cfargument name="head" type="core.valueObjects.Head" required="yes">
>
>        <cfset variables.head = ARGUMENTS.head>
>
> </cffunction>
>
> However when I call the function from the testing page with :
>
> <cfset page.setHead(head)>
>
> I get an error : -
>
> The HEAD argument passed to the setHead function is not of type
> core.valueObjects.Head.
>
> When as far as I'm concerned it is.  The fix I came up with is to change the
> argument in the setHead function to be only Head.  Now this sort of works as
> Page and Had live in the same folder, but I can see problems further down
> the line unless I get this clear in my head.
>
> So am I a - doing this wrong, should there be a special "place" or method of
> creating CF classes where they can reference each other with complete class
> paths?
>            b - Just accept that the classes can only reference each other
> relatively?
>            c - Go back to actionscript and stop pretending to be a server
> side coder?
>
> Thanks in advance
>
> Tim
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290863
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to