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

EO advice


  • Subject: EO advice
  • From: Theodore Petrosky <email@hidden>
  • Date: Fri, 06 Jun 2014 09:51:30 -0400

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)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: EO advice
      • From: Ken Anderson <email@hidden>
  • Prev by Date: ERXPartials and ERRest
  • Next by Date: Re: EO advice
  • Previous by thread: ERXPartials and ERRest
  • Next by thread: Re: EO advice
  • Index(es):
    • Date
    • Thread