• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to delete an EO?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to delete an EO?


  • Subject: How to delete an EO?
  • From: Bill Reynolds <email@hidden>
  • Date: Fri, 16 Apr 2004 21:49:16 -0700

This has got to be one of those "so simple it will make me feel stupid"
questions (but I'll ask anyway).

Below is the code from a component.  It's pretty simple, there's a single
variable that contains an EO ("userRecord").  I can use it's editingContext
to update it and that all works great.

I've created a function for 'deleting' the object and I can't seem to find
the right way to go about it.  As you can see in my deleteRecord() function
below I've tried just about every combination, but I can't delete my
'userRecord' object from the database.

What the heck am I doing?

Much appreciation,

-Bill



public class AdminEditRegUser extends WOComponent {

    protected RegUsers userRecord;

    public AdminEditRegUser(WOContext context) {
        super(context);

    }

    public WOComponent deleteRecord()
    {
        //userRecord().editingContext().deleteObject(userRecord);
        userRecord().editingContext().deleteObject(userRecord());
        userRecord().editingContext().saveChanges();
        //EOEditingContext ec = session().defaultEditingContext();
        //EOEditingContext ec = userRecord().editingContext();
        //ec.deleteObject(userRecord());
        //ec.saveChanges();
        return null;
    }

    public WOComponent updateRecord()
    {
        if(onMailingsChecked == 0)
        {
            userRecord.setON_MAILINGS("0");
        }else{
            userRecord.setON_MAILINGS("1");
        }

        if(needsFollowupChecked == 0)
        {
            userRecord.setFOLLOW_UP("0");
        }else{
            userRecord.setFOLLOW_UP("1");
        }

        userRecord().editingContext().saveChanges();
        return null;
    }

}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: How to delete an EO?
      • From: Jonathan Rochkind <email@hidden>
    • Re: How to delete an EO?
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Posting vars programatically from component to Direct Action
  • Next by Date: backtracking and Mac browsers
  • Previous by thread: [OT] Javascript sending down a variable to a Perl script
  • Next by thread: Re: How to delete an EO?
  • Index(es):
    • Date
    • Thread