Tried that 

result = getClassVariable( variableName = "hash" & hash( getMetaData( this
).name ), scope = getSingletonScope() );
return result; 

No luck.

More info:
I have my object 
<cfcomponent 
        name="FormProcess" 
        extends="com.pacificMomentum.Object" 

Which extends Object, in which the getInstance() method is present.
<cffunction 
                access="private" 
                name="getInstance" 
                output="false" 
                returntype="Object" 
                displayname="Get Instance" 
                hint="Returns an instance of the object, gets it from the
persistent scope if the class is a singleton.">

                <cfscript>
                var mySingletonPath = "";
                // Check if this object is a singleton
                if ( isSingleton() )
                {
                        mySingletonPath = getSingletonScope() & ".hash" &
getClassPathAsHash() & ".hash" & hash( getMetaData( this ).name );
                        // Check if the singleton is instantiated
                        if ( NOT isDefined( mySingletonPath ) )
                        {
                                setInstanceVariable( variableName =
"initialized", value = true );
                                setClassVariable( variableName = "hash" &
hash( getMetaData( this ).name ), value = this, scope = getSingletonScope()
);
                        }
                        // Return the Singleton
                        //getClassVariable( variableName = "hash" & hash(
getMetaData( this ).name ), scope = getSingletonScope()
).dumpInstance();abort();
                        result = getClassVariable( variableName = "hash" &
hash( getMetaData( this ).name ), scope = getSingletonScope() );
                        return result; 
                }
                setInstanceVariable( variableName = "initialized", value =
true );
                // Return a new instance of this object
                return this;
                </cfscript>

     </cffunction>

I have my init method in the FormProcess object
<!--- Constructor --->
        <cffunction 
                name="init" 
                access="public" 
                returntype="FormProcess" 
        output="no">

                <cfargument 
                        name="XMLProcess" 
                        type="com.pacificMomentum.data.type.XML" 
                        required="yes" />
                <cfargument 
                        name="processName" 
                        type="string" 
                        required="yes" />
                <cfargument 
                        name="groupName" 
                        type="string" 
                        required="yes" />
                <cfargument 
                        name="stepName" 
                        type="string" 
                        required="yes" />

                <cfscript>
                super.init();

                setXMLProcess( arguments.XMLProcess );
                setProcessName( arguments.processName );
                createGroupName( arguments.groupName );
                setCurrentGroupName( arguments.groupName );
                setCurrentStepName( arguments.stepName );
                createStepName( stepName = arguments.stepName );

                return getInstance();
                </cfscript>

        </cffunction>

Which as you can see should return the object returned from the getInstance
method.

If I go into the getInstance() method and dump the result, it actually dumps
the object I want from the persistent scope!!??

When I add
getInstance().dumpInstance();abort();
To the above init() method it also dumps the right instance.

BUT, when I do the same for
FormProcess = createObject( "component",
"development.shelco_company_registration_form.class.FormProcess" );
FormProcess.init( XMLProcess = XMLProcess, processName =
"companyRegistration", groupName = request.thisGroup, stepName =
request.thisStep );
FormProcess.dumpInstance()
It dumps the new instance... What is going on?

Thanks.... ;-) got it, while going through this process I found where it
went wrong and had another had look at >>
FormProcess = createObject( "component", "class.FormProcess" );
FormProcess.init( XMLProcess = XMLProcess, processName =
"companyRegistration", groupName = request.thisGroup, stepName =
request.thisStep );

Assigns the object as is
FormProcess = createObject( "component", "class.FormProcess" );
Then I call init() and it must not override the previously returned object

Because if I do
FormProcess = createObject( "component", "class.FormProcess" ).init(
XMLProcess = XMLProcess, processName = "companyRegistration", groupName =
request.thisGroup, stepName = request.thisStep );
It all works like a charm, not sure whether the first example should have
worked or not?????

________________________________
Taco Fleur - E-commerce Development Manager
Shelco Searches & Services
An Authorised ASIC Information Broker
www.shelco.com.au
Ph: + 61 7 3236 2605



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to