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 protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]