• 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
Re: EOGenerator Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOGenerator Relationships


  • Subject: Re: EOGenerator Relationships
  • From: Michael Kondratov <email@hidden>
  • Date: Wed, 17 Sep 2008 11:35:58 -0400

I've added takeStoredValueForKey(value, INVOICE_STATUS_KEY); and now it works! Thank you so much. I was totally confused.

Michael
Aspire Auctions
216-231-5515
www.aspireauctions.com

On Sep 17, 2008, at 11:26 AM, Florijan Stamenkovic wrote:


On Sep 17, 2008, at 10:56, Michael Kondratov wrote:

The object is in the EC.

I've tried changing Invoice method from setInvoiceStatusRelationship(InvoiceStatus value) to setInvoiceStatus(InvoiceStatus value)

Now setInvoiceStatus in Invoice does get exceuted, however I am not able to call super.setInvoiceStatusRelationship(value) because they start calling each other!!

That's because setInvoiceStatusRelationship(value) calls addObjectToBothSidesOfRelationship(...) which in turn calls setInvoiceStatus(value).

You need to get into how WO's key value coding works. Check out the documentation for EOCustomObject, specifically these methods:

addObjectToBothSidesOfRelationship
takeValueForKey
takeStoredValueForKey

As for your problem, from what I understand you are trying to achieve, you should override setInvoiceStatus(value) in your Invoice class to do the extra work. Your method should look like this:

public void setInvoiceStatus(InvoiceStatus value) {
    if(value != invoiceStatus()) {
        System.out.println("updating invoice status date");
this.setInvoiceStatusDate(new NSTimestamp());
takeStoredValueForKey(value, INVOICE_STATUS_KEY);
        }
  }

You calling code should however use setInvoiceStatusRelationship(...) to reap it's benefits, which will in turn call your setInvoiceStatus(...) method. Also note that the first line in that method only applies if the two InvoiceStatus EOs are in the same EC.

F

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >EOGenerator Relationships (From: Michael Kondratov <email@hidden>)
 >Re: EOGenerator Relationships (From: David Avendasora <email@hidden>)
 >Re: EOGenerator Relationships (From: Florijan Stamenkovic <email@hidden>)
 >Re: EOGenerator Relationships (From: David Avendasora <email@hidden>)
 >Re: EOGenerator Relationships (From: Michael Kondratov <email@hidden>)
 >Re: EOGenerator Relationships (From: Florijan Stamenkovic <email@hidden>)

  • Prev by Date: Re: EOGenerator Relationships
  • Next by Date: Re: EOGenerator Relationships
  • Previous by thread: Re: EOGenerator Relationships
  • Next by thread: Re: EOGenerator Relationships
  • Index(es):
    • Date
    • Thread