• 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: EO advice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO advice


  • Subject: Re: EO advice
  • From: Ken Anderson <email@hidden>
  • Date: Fri, 06 Jun 2014 10:22:10 -0400

Well OK then!  Someone should up the commandments.  Thanks John.

On Jun 6, 2014, at 10:21 AM, John Huss <email@hidden> wrote:

Except awakeFromInsertion is buggy and replaced by init in Wonder:

/**
* used for initialization stuff instead of awakeFromInsertion.
* <code>awakeFromInsertions</code> is buggy because if an EO is deleted
* and then its EOEditingContext is reverted using 'revert' for example then
* EOF will -insert- this EO again in its EOEditingContext which in turn
* calls awakeFromInsertion again.
* /
protected void init(EOEditingContext ec)



On Fri, Jun 6, 2014 at 9:18 AM, Ken Anderson <email@hidden> wrote:
Please read the relevant commandment - :)

http://wiki.wocommunity.org/display/documentation/EOF-Using+EOF-The+EOF+Commandments

Ken

On Jun 6, 2014, at 10:17 AM, Theodore Petrosky <email@hidden> wrote:

Why did you choose this method to override?

Why do you not use the init method? Does the awake method happen later in the creation of the Entity?

Ted


On Jun 6, 2014, at 10:05 AM, Ken Anderson <email@hidden> wrote:

Ted,

I put this type of stuff in:

public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);

// my code
}

Ken

On Jun 6, 2014, at 9:51 AM, Theodore Petrosky <email@hidden> wrote:

I am starting a project. a booking app for a theater. basically I want to assign all my primary players to a show date when I create a new show date (event).

I could have 50 musicians, but only 10 are the primary players. my Person entity has a boolean 'isPrimary' to indicate that this person is a primary player.

Entity ShowDate has a to many relationship to showPerson 
Entity Person has a to many relationship to showPerson 

In my init method of ShowDate I added:

  public void init(EOEditingContext ec) {
    super.init(ec);
    
    for (Person aPerson: Person.fetchPersons(ec, Person.IS_PRIMARY.eq(true).and(Person.CURRENT.eq(true)), null)) {
      ShowPerson.createShowPerson(ec, aPerson, this);  
    }
  }

This is working beautifully. When I create a new ShowDate, I get all the primary musicians added to the date.

am I stepping on myself? Since the init method is only called when we create a new instance of an entity, this can only get called once, yes? There isn't a betterer (that's real good english) way? Or a more WO prescribed way?

I am making this up as I go and when I stumble across a method that works, I question when it is so easy.

Ted
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)

This email sent to email@hidden




 _______________________________________________
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


 _______________________________________________
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

  • Follow-Ups:
    • Re: EO advice
      • From: Theodore Petrosky <email@hidden>
References: 
 >EO advice (From: Theodore Petrosky <email@hidden>)
 >Re: EO advice (From: Ken Anderson <email@hidden>)
 >Re: EO advice (From: Theodore Petrosky <email@hidden>)
 >Re: EO advice (From: Ken Anderson <email@hidden>)
 >Re: EO advice (From: John Huss <email@hidden>)

  • Prev by Date: Re: EO advice
  • Next by Date: Re: EO advice
  • Previous by thread: Re: EO advice
  • Next by thread: Re: EO advice
  • Index(es):
    • Date
    • Thread