Nope, it's not.  CFPROPERTY is only used for describing data structures for
web services.

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-b18.htm



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Cutter (CF-Talk)
Sent: Saturday, July 17, 2004 12:16 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Is this not possible?

I have created a CFC object with these basic properties:

<cfproperty name="ID" type="numeric" default="0">
    <cfproperty name="category" type="Category">
    <cfproperty name="subcategory" type="string">
    <cfproperty name="sscategory" type="SubSubCategory">
    <cfproperty name="ladiesonly" type="boolean">
    <cfproperty name="status" type="boolean">

With an init() method like this:

<cffunction name="init" access="public" output="false" returntype="struct">
      <cfargument name="ID" type="numeric" default="0">
      <cfscript>
      instance = structNew();
      instance.ID = 0;
      instance.category = createobject('component','Category');
         instance.subcategory = "";
      instance.sscategory = createobject('component','SubSubCategory');
      instance.ladiesonly = 0;
         instance.status = 0;
      </cfscript>

      <cfif arguments.ID neq 0>
           <cfquery name="subcat" maxrows="1" 
datasource="#application.config.DSN#">
            select      intBoutCatID as catID,
                                        txtBoutSubCat as subcategory,
                                        intSSCatID as sscatID,
                                        blLadies as ladiesonly,
                                        blActive as status
            from        tblboutsubcat
            where       intBoutSubCatID = <cfqueryparam 
value="#arguments.ID#" cfsqltype="cf_sql_integer">
           </cfquery>

            <cfif subcat.recordcount eq 1>
                <cfscript>
                instance.ID = arguments.ID;
                instance.category = instance.category.get(subcat.catID);
                           instance.subcategory = subcat.subcategory;
                instance.sscategory = 
instance.sscategory.get(subcat.sscatID);
                instance.ladiesonly = subcat.ladiesonly;
                instance.status = subcat.status;
                </cfscript>
           </cfif>
      </cfif>

      <cfreturn this>
   </cffunction>

As you can see two of the properties of the object are other custom 
objects (category and subsubcategory). I always thought this was 
possible, but I'm new at this so...

Anyway, I'm creating a backend editor for populating the db. In the 
"Edit" form, I create an instance like so:

<cfscript>
        formSubCat = 
CreateObject("component","#application.config.CFCOMPONENTS_PREFIX#com.seacre
ts.boutique.subcategory").init(#url.id#);
</cfscript>

This does create the object. I am able to populate various fields of the 
form like this:

<input type="hidden" name="id" 
value="#htmleditformat(trim(formSubCat.getID()))#" />

My trouble comes when I try to access one of the object properties that 
is, itself, a custom object. For instance, I call a method to get the 
category object's ID:

<select class="boxes" name="category">
        <option value="">-- --</option>
        <cfoutput query="qCats">
                <option value="#qCats.ID#"<cfif qCats.ID eq 
#trim(formSubCat.getCatID())#> selected</cfif>>#qCats.Name#</option>
        </cfoutput>
</select>

This calls the following method in the subcategory CFC:

<cffunction name="getCatID" access="public" output="true" 
returntype="numeric">
        <cfreturn instance.category.getID()>
</cffunction>

Now, in theory, this should be a no brainer, it should call the getID() 
method of the category object that is present in the current instance 
from the category CFC. However, I get the following error:

The selected method getID was not found.
Either there are no methods with the specified method name and argument 
types, or the method getID is overloaded with arguments types that 
ColdFusion can't decipher reliably. If this is a Java object and you 
verified that the method exists, you may need to use the javacast 
function to reduce ambiguity.

The error occurred in 
/home/httpd/seacrets/system/cfcomponents/com/seacrets/boutique/subcategory.c
fc: 
line 162
Called from /home/httpd/seacrets/secure/editor/_subcat.cfm: line 260
Called from /home/httpd/seacrets/secure/editor/main.cfm: line 93

160 :   </cffunction>
161 :
162 :   <cffunction name="getCatID" access="public" output="true" 
returntype="numeric">
163 :           <cfreturn instance.category.getID()>
164 :   </cffunction>


...And then the stack trace stuff. Is this just not possible? Am I off 
my rocker here? If I can't do it this way then how should it be done?

Cutter
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to