Rob,

I currently handle soft deletes (when required) using a delete() method on
my TO decorator.  Say I have a an e-commerce catalog with categories and
items and categories are recursive.  If a category has related items or
sub-categories, I want to soft delete.  Here's the method to handle that:

    <cffunction name="delete" hint="Delete the current instance"
returntype="void" output="false" access="public">

        <cfscript>
            if (isParent() || hasItem()) {
                // enact soft delete
                setIsDeleted(true);
                getCatalogDao().save(this);
            } else {
                getCatalogDao().delete(this);
            }
        </cfscript>
    </cffunction>

In my service, I would then use something along the line of.

    <cffunction name="deleteCategory" returntype="void" output="false"
access="public">
        <cfargument name="CategoryId" type="numeric" required="true">
        <cfscript>
            var category = getCategory(arguments.CategoryId);
            category.delete();
        </cfscript>
    </cffunction>

I prefer this approach since it encapsulates the delete logic in the
business object.

HTH

Paul

On Tue, Mar 3, 2009 at 8:08 AM, Sir Rawlins <
robert.rawl...@thinkbluemedia.co.uk> wrote:

>
> Hi John, thanks.
>
> Yeah the way I see its implementation working would be to keep the
> delete method invoketion the same, just change its implementation
> dependant on the XML configuration, this would allow some objects to
> be properly deleted and other only soft deleted likewise with
> cascading the deletes, sometimes I'll want a parent object to be soft
> deleted but its children are not audited so they can be properly
> removed :-)
>
> I kind of remember someone mentioning it was on the roadmap when I
> last asked a few months back, perhaps I'll play around with some
> patches and suggestions for Mark and see if I cant accelerate it a
> little.
>
> Rob
>
> On Mar 3, 4:01 pm, John Whish <john.wh...@googlemail.com> wrote:
> > I believe that soft delete is already on the road map. I haven't tried
> it,
> > but you should be able to overwrite the Transfer save method to do an
> update
> > instead of a delete. So you code would still call the delete method.
> >
>


-- 
Paul Marcotte
Fancy Bread - in the heart or in the head?
http://www.fancybread.com

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

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

Reply via email to