Try adding the following delete function to mySpecialObject.cfc
I haven't actually run this so their will ;) be syntax errors. Let me  
know and I can help you fix. It should be relatively self explanatory  
though.
As always, PLEASE backup before you run any code that I write ;)
        
        <cffunction name="delete" access="public" hint="Deletes related  
objects before deleting this object" returntype="struct" output="false">
                <cfargument name="objectid" required="yes" type="UUID" 
hint="Object  
ID of the object being deleted">
                <cfargument name="user" type="string" required="true"  
hint="Username for object creator" default="">
                <cfargument name="auditNote" type="string" required="true"  
hint="Note for audit trail" default="">
                
                <!--- CHANGE THESE VARIABLES AS REQUIRED --->           
                <cfset var relatedTypename = "myCustomObject" />
                <cfset var relatedTypenameArrayTable =  
"myCustomObject_aSpecialObjectIDs" />
                
                <!--- LEAVE THESE VARIABLES AS IS --->
                <cfset var st = structNew() />
                <cfset var stSuccess = structNew() />
                <cfset var qRelated = queryNew("blah") />
                <cfset var qDelete = queryNew("blah") />
                <cfset var objectBroker = createObject("component",  
"farcry.core.packages.fourq.objectBroker") />
                
                <!--- FIND ALL THE RELATED myCustomObject's --->
                <cfquery datasource="#application.dsn#" name="qRelated">
                SELECT parentID FROM #relatedTypenameArrayTable#
                WHERE data = <cfqueryparam cfsqltype="cf_sql_varchar"  
value="#arguments.objectid#">
                </cfquery>      
                
                <!--- DELETE ALL THE RELATED myCustomObject's --->
                <cfquery datasource="#application.dsn#" name="qDelete">
                DELETE FROM #relatedTypenameArrayTable#
                WHERE data = <cfqueryparam cfsqltype="cf_sql_varchar"  
value="#arguments.objectid#">
                </cfquery>      
                        
                <!--- REMOVE THE RELATED myCustomObject from the object broker, 
so  
that it will refresh without the deleted specialObject references --->
                <cfset objectBroker.RemoveFromObjectBroker 
(lObjectIDs="#structKeyList(qRelated.parentID)#",  
typename="#relatedTypename#")>
                
                <!--- CALL THE SUPER DELETE FUNCTION TO FINALLY DELETE THE 
OBJECT  
--->            
                <cfset stReturn = super.delete(objectid=arguments.objectid,  
user=arguments.user, auditNote=arguments.auditNote) />
                
                
                <cfreturn stReturn />
        </cffunction>

Kind regards

-- 
-- Matthew Bryant
Product Development Manager
Daemon Internet Consultants
Adobe Solutions Partner
http://www.daemon.com.au/
p. 02 9380 4162
f. 02 9380 4204




On 22/06/2007, at 5:55 AM, Derek Westfall wrote:

> Assuming I have this object relationship:
>
> myCustomObject.cfc
>     cfproperty name=aSpecialObjectIDs type="array" hint="array of  
> mySpecialObject IDs"
>
>
> mySpecialObject.cfc
>     cfproperty name="title"
>
> What can I do with the ft:objectadmin for typename=mySpecialObject  
> to make sure that when I delete a mySpecialObject, the  
> myCustomObject.aSpecialObjectIDs gets updated?
>
> Should I add a <ft:processform action="delete"> above the  
> ft:objectadmin and handle it there, or should I add a delete  
> function to myspecialobject.cfc to override the core delete function?
>
> Or do you just not worry about deleted objects in arrays?
>
> Thanks,
>
> Derek Westfall
>
>
> >
>
> Message protected by MailGuard: e-mail anti-virus, anti-spam and  
> content filtering.
> http://www.mailguard.com.au/mg
>
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to